From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751415AbbJ3EUP (ORCPT ); Fri, 30 Oct 2015 00:20:15 -0400 Received: from mail113-249.mail.alibaba.com ([205.204.113.249]:38877 "EHLO us-alimail-mta2.hst.scl.en.alidc.net" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750729AbbJ3EUN (ORCPT ); Fri, 30 Oct 2015 00:20:13 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e02c03283;MF=hillf.zj@alibaba-inc.com;NM=1;PH=DS;RN=12;SR=0; Reply-To: "Hillf Danton" From: "Hillf Danton" To: , Cc: "'Andrew Morton'" , "'Linus Torvalds'" , "'Mel Gorman'" , "'Johannes Weiner'" , "'Rik van Riel'" , "'David Rientjes'" , "'Tetsuo Handa'" , "'LKML'" , "'Michal Hocko'" , "Christoph Lameter" References: <1446131835-3263-1-git-send-email-mhocko@kernel.org> <1446131835-3263-3-git-send-email-mhocko@kernel.org> In-Reply-To: <1446131835-3263-3-git-send-email-mhocko@kernel.org> Subject: Re: [RFC 2/3] mm: throttle on IO only when there are too many dirty and writeback pages Date: Fri, 30 Oct 2015 12:18:50 +0800 Message-ID: <00f301d112ca$14db86c0$3e929440$@alibaba-inc.com> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQIGF4V16nJn0fm7R3FtGSuNfAoIRwI/btqxngdnrRA= Content-Language: zh-cn Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -3191,8 +3191,23 @@ __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order, > */ > if (__zone_watermark_ok(zone, order, min_wmark_pages(zone), > ac->high_zoneidx, alloc_flags, target)) { > - /* Wait for some write requests to complete then retry */ > - wait_iff_congested(zone, BLK_RW_ASYNC, HZ/50); > + unsigned long writeback = zone_page_state(zone, NR_WRITEBACK), > + dirty = zone_page_state(zone, NR_FILE_DIRTY); > + > + if (did_some_progress) > + goto retry; > + > + /* > + * If we didn't make any progress and have a lot of > + * dirty + writeback pages then we should wait for > + * an IO to complete to slow down the reclaim and > + * prevent from pre mature OOM > + */ > + if (2*(writeback + dirty) > reclaimable) > + congestion_wait(BLK_RW_ASYNC, HZ/10); > + else > + cond_resched(); > + Looks the vmstat updater issue is not addressed. > goto retry; > } > } > -- > 2.6.1