From patchwork Tue Jun 11 01:12:16 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 17756 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gh0-f199.google.com (mail-gh0-f199.google.com [209.85.160.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D445725DF9 for ; Tue, 11 Jun 2013 01:12:59 +0000 (UTC) Received: by mail-gh0-f199.google.com with SMTP id g14sf4333881ghb.2 for ; Mon, 10 Jun 2013 18:12:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=+kuUKJWNYXi/k2KI7qNpV8hJ+hGnj4VHcbrSbVVtN5g=; b=LaKxeJDXvzjkUWm+slBbJN+6i5dPYlciOanbzMBntTxBk/jQn6LI1zn1Xd5ueMAcCG nlKodj/39H7Vc5B6FWDjXJImWqoUzOfNq3vwmRwO4KdTNRpq81niq9/tOHP3J8u+j5FY a2sq5A6AGd41+PxxOtGTaeD9ESfgDLryTUgc+nOS+iLktyOem+Rv7MqmP5RK+dCNaHCV mD4EB9WCMpbtAWTSn3oSBsbZS/n60TwbwbEwajIczgAwnudJMwOt5dOtFbWZJIe1UDH2 xDaczKFu5NfUsxSlvBHGFLdIW67recsQqjBf4+LjB+kZEqb8JSLWCumADu7XWnPUxPLP idXg== X-Received: by 10.224.205.138 with SMTP id fq10mr9769103qab.1.1370913179601; Mon, 10 Jun 2013 18:12:59 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.121.227 with SMTP id ln3ls959396qeb.0.gmail; Mon, 10 Jun 2013 18:12:59 -0700 (PDT) X-Received: by 10.52.22.78 with SMTP id b14mr5281737vdf.27.1370913179384; Mon, 10 Jun 2013 18:12:59 -0700 (PDT) Received: from mail-vb0-x22a.google.com (mail-vb0-x22a.google.com [2607:f8b0:400c:c02::22a]) by mx.google.com with ESMTPS id cz2si1508504vcb.2.2013.06.10.18.12.59 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 18:12:59 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400c:c02::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=2607:f8b0:400c:c02::22a; Received: by mail-vb0-f42.google.com with SMTP id i3so4524382vbh.1 for ; Mon, 10 Jun 2013 18:12:59 -0700 (PDT) X-Received: by 10.52.170.148 with SMTP id am20mr6107037vdc.75.1370913179264; Mon, 10 Jun 2013 18:12:59 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.221.10.206 with SMTP id pb14csp89608vcb; Mon, 10 Jun 2013 18:12:58 -0700 (PDT) X-Received: by 10.66.144.170 with SMTP id sn10mr16276000pab.42.1370913178385; Mon, 10 Jun 2013 18:12:58 -0700 (PDT) Received: from mail-pa0-x230.google.com (mail-pa0-x230.google.com [2607:f8b0:400e:c03::230]) by mx.google.com with ESMTPS id ra8si7976250pab.62.2013.06.10.18.12.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 18:12:58 -0700 (PDT) Received-SPF: neutral (google.com: 2607:f8b0:400e:c03::230 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=2607:f8b0:400e:c03::230; Received: by mail-pa0-f48.google.com with SMTP id kp12so3300467pab.21 for ; Mon, 10 Jun 2013 18:12:57 -0700 (PDT) X-Received: by 10.68.213.231 with SMTP id nv7mr12440501pbc.70.1370913177799; Mon, 10 Jun 2013 18:12:57 -0700 (PDT) Received: from localhost.localdomain (c-67-170-153-23.hsd1.or.comcast.net. [67.170.153.23]) by mx.google.com with ESMTPSA id qe10sm9802489pbb.2.2013.06.10.18.12.56 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 10 Jun 2013 18:12:57 -0700 (PDT) From: John Stultz To: minchan@kernel.org Cc: dgiani@mozilla.com, John Stultz Subject: [PATCH 10/13] vrange: Get rid of dependency that all pages is from a zone in shrink_page_list Date: Mon, 10 Jun 2013 18:12:16 -0700 Message-Id: <1370913139-9320-11-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1370913139-9320-1-git-send-email-john.stultz@linaro.org> References: <1370913139-9320-1-git-send-email-john.stultz@linaro.org> X-Gm-Message-State: ALoCoQle5iyTMgA+iZsTS0fYoNOwXxHqox4Qf68tm1n5CmNg812CyltttSsWKdZjDQD+BZ4biDGw X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 2607:f8b0:400c:c02::22a is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Minchan Kim Now shrink_page_list expect all pages come from a same zone but it's too limited to use it. This patch removes the dependency and add may_discard in scan_control so next patch can use shrink_page_list with pages from multiple zones. Signed-off-by: Minchan Kim Signed-off-by: John Stultz --- mm/vmscan.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index c75e0ac..4107c07 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -78,6 +78,9 @@ struct scan_control { /* Can pages be swapped as part of reclaim? */ int may_swap; + /* Discard pages in vrange */ + int may_discard; + int order; /* Scan (total_size >> priority) pages at once */ @@ -715,7 +718,8 @@ static unsigned long shrink_page_list(struct list_head *page_list, goto keep; VM_BUG_ON(PageActive(page)); - VM_BUG_ON(page_zone(page) != zone); + if (zone) + VM_BUG_ON(page_zone(page) != zone); sc->nr_scanned++; @@ -786,6 +790,10 @@ static unsigned long shrink_page_list(struct list_head *page_list, ; /* try to reclaim the page below */ } + /* Fail to discard a page and returns a page to caller */ + if (sc->may_discard) + goto keep_locked; + /* * Anonymous process memory has backing store? * Try to allocate it some swap space here. @@ -964,7 +972,8 @@ keep: * back off and wait for congestion to clear because further reclaim * will encounter the same problem */ - if (nr_dirty && nr_dirty == nr_congested && global_reclaim(sc)) + if (nr_dirty && nr_dirty == nr_congested && global_reclaim(sc) && + zone) zone_set_flag(zone, ZONE_CONGESTED); free_hot_cold_page_list(&free_pages, 1);