From patchwork Thu Oct 3 00:51:43 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 20764 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-gg0-f199.google.com (mail-gg0-f199.google.com [209.85.161.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8354B238F9 for ; Thu, 3 Oct 2013 00:52:33 +0000 (UTC) Received: by mail-gg0-f199.google.com with SMTP id h3sf1539096gge.2 for ; Wed, 02 Oct 2013 17:52:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=PVH5mroRuLRl33rEhrm3bNOcWDY4y6aaupvN0BMoILc=; b=LlYqQBF300NsveZAfjJRz30k9wVzjf62oeIlEgbKTGG4U4cd/P2eXScEUk/F2+matf prmjyBSJdhLstK7s9t7BnHEQbChD6/fTG0amD6LFTWIJ+3wVua3t9fFtNh+RVYCFU3gx f0wA7hXBPulIisK0Y/M6bx3+6/+Pl1+6kIcbE6t1bg1OpdsZi58yz6i8FbD3rL19QNIr uCf/FLjy2euvfJkZ/LtJLE0KKL0VM7nK1QA7a/vXtrYhUlrAsQ/OcN3qlChC9tlfYQZK eMm33iEz0co/8vuM+W5Km9O2AQq8Ds2aXam1I4ZHEbGF9PXHPaWdxpLHJwT63Fyopga8 mNRg== X-Received: by 10.236.116.135 with SMTP id g7mr5027969yhh.53.1380761553316; Wed, 02 Oct 2013 17:52:33 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.0.236 with SMTP id 12ls731291qeh.67.gmail; Wed, 02 Oct 2013 17:52:33 -0700 (PDT) X-Received: by 10.220.11.7 with SMTP id r7mr4686707vcr.12.1380761553201; Wed, 02 Oct 2013 17:52:33 -0700 (PDT) Received: from mail-vc0-f175.google.com (mail-vc0-f175.google.com [209.85.220.175]) by mx.google.com with ESMTPS id qf5si1034902vec.144.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Oct 2013 17:52:33 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.175 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.175; Received: by mail-vc0-f175.google.com with SMTP id ia10so593596vcb.34 for ; Wed, 02 Oct 2013 17:52:33 -0700 (PDT) X-Gm-Message-State: ALoCoQmDVqq3QgixDpME3jd8/WpbWS3dKtZZp+1ZDQE63xdAxOjugFKpSgsX+JVdkJ6joUJnRlaL X-Received: by 10.52.36.239 with SMTP id t15mr3890609vdj.11.1380761553099; Wed, 02 Oct 2013 17:52:33 -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.220.174.196 with SMTP id u4csp137549vcz; Wed, 2 Oct 2013 17:52:32 -0700 (PDT) X-Received: by 10.68.232.3 with SMTP id tk3mr5407905pbc.121.1380761552268; Wed, 02 Oct 2013 17:52:32 -0700 (PDT) Received: from mail-pd0-f170.google.com (mail-pd0-f170.google.com [209.85.192.170]) by mx.google.com with ESMTPS id yk3si3890913pac.302.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Oct 2013 17:52:32 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.192.170 is neither permitted nor denied by best guess record for domain of john.stultz@linaro.org) client-ip=209.85.192.170; Received: by mail-pd0-f170.google.com with SMTP id x10so1674368pdj.15 for ; Wed, 02 Oct 2013 17:52:31 -0700 (PDT) X-Received: by 10.66.228.38 with SMTP id sf6mr6177666pac.21.1380761551665; Wed, 02 Oct 2013 17:52:31 -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 gh2sm4507018pbc.40.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 02 Oct 2013 17:52:30 -0700 (PDT) From: John Stultz To: LKML Cc: Minchan Kim , Andrew Morton , Android Kernel Team , Robert Love , Mel Gorman , Hugh Dickins , Dave Hansen , Rik van Riel , Dmitry Adamushko , Dave Chinner , Neil Brown , Andrea Righi , Andrea Arcangeli , "Aneesh Kumar K.V" , Mike Hommey , Taras Glek , Dhaval Giani , Jan Kara , KOSAKI Motohiro , Michel Lespinasse , Rob Clark , "linux-mm@kvack.org" , John Stultz Subject: [PATCH 14/14] vrange: Add vmstat counter about purged page Date: Wed, 2 Oct 2013 17:51:43 -0700 Message-Id: <1380761503-14509-15-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1380761503-14509-1-git-send-email-john.stultz@linaro.org> References: <1380761503-14509-1-git-send-email-john.stultz@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: john.stultz@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.175 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 This patch adds the number of purged page in vmstat so admin can see how many of volatile pages are discarded by VM until now. Cc: Andrew Morton Cc: Android Kernel Team Cc: Robert Love Cc: Mel Gorman Cc: Hugh Dickins Cc: Dave Hansen Cc: Rik van Riel Cc: Dmitry Adamushko Cc: Dave Chinner Cc: Neil Brown Cc: Andrea Righi Cc: Andrea Arcangeli Cc: Aneesh Kumar K.V Cc: Mike Hommey Cc: Taras Glek Cc: Dhaval Giani Cc: Jan Kara Cc: KOSAKI Motohiro Cc: Michel Lespinasse Cc: Rob Clark Cc: Minchan Kim Cc: linux-mm@kvack.org Signed-off-by: Minchan Kim Signed-off-by: John Stultz --- include/linux/vm_event_item.h | 2 ++ mm/vmstat.c | 2 ++ mm/vrange.c | 10 ++++++++++ 3 files changed, 14 insertions(+) diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index bd6cf61..c4aea92 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -25,6 +25,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, FOR_ALL_ZONES(PGALLOC), PGFREE, PGACTIVATE, PGDEACTIVATE, PGFAULT, PGMAJFAULT, + PGDISCARD_DIRECT, + PGDISCARD_KSWAPD, FOR_ALL_ZONES(PGREFILL), FOR_ALL_ZONES(PGSTEAL_KSWAPD), FOR_ALL_ZONES(PGSTEAL_DIRECT), diff --git a/mm/vmstat.c b/mm/vmstat.c index 20c2ef4..4f35f46 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -756,6 +756,8 @@ const char * const vmstat_text[] = { "pgfault", "pgmajfault", + "pgdiscard_direct", + "pgdiscard_kswapd", TEXTS_FOR_ZONES("pgrefill") TEXTS_FOR_ZONES("pgsteal_kswapd") diff --git a/mm/vrange.c b/mm/vrange.c index c30e3dd..8931fab 100644 --- a/mm/vrange.c +++ b/mm/vrange.c @@ -894,6 +894,10 @@ int discard_vpage(struct page *page) if (page_freeze_refs(page, 1)) { unlock_page(page); + if (current_is_kswapd()) + count_vm_event(PGDISCARD_KSWAPD); + else + count_vm_event(PGDISCARD_DIRECT); return 0; } } @@ -1144,6 +1148,12 @@ static int discard_vrange(struct vrange *vrange) ret = __discard_vrange_file(mapping, vrange, &nr_discard); } + if (!ret) { + if (current_is_kswapd()) + count_vm_events(PGDISCARD_KSWAPD, nr_discard); + else + count_vm_events(PGDISCARD_DIRECT, nr_discard); + } out: __vroot_put(vroot); return nr_discard;