From patchwork Tue Oct 1 18:38:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Stultz X-Patchwork-Id: 20738 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f197.google.com (mail-vc0-f197.google.com [209.85.220.197]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 9FE7023920 for ; Tue, 1 Oct 2013 18:39:20 +0000 (UTC) Received: by mail-vc0-f197.google.com with SMTP id gd11sf8331251vcb.8 for ; Tue, 01 Oct 2013 11:39:20 -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: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=EudU+uWK4/U0fRdxymlenZCrtiDZiG8tmHdHIqTOt8E=; b=NIaM7oaIHlZwihu9EZ56DwTaVNHI/t08auTT5Sp1kMxK+tLGYopkBBohmCO9/q/L3a EEnee2bUu9nGUoIQg32xpS/dnSVAVvqWmA+QorH67Xa4Bzo/SqVBmA/A2SolxUORJ0Wd 4DVgfHol9Af8Yah9ivPiqI/AhvG5lyssJEIzrzAI5Ya8Eh+RtbIawhQCUIRgi363hv4Q aZK2fiOEHgKREcynw2FTI3SR8IeBa8Efnuz8u0L3AfMt5BaYB0LmEr5HoZYPvs56ap09 BuRvU2U4NHsv0JRTerBV8IbxIz7TOV2CwBm37zWcxah9hULhIW0gvsM88DuUJsrSQj4F W0bg== X-Received: by 10.58.206.33 with SMTP id ll1mr2315401vec.10.1380652760369; Tue, 01 Oct 2013 11:39:20 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.84.201 with SMTP id b9ls197057qez.62.gmail; Tue, 01 Oct 2013 11:39:20 -0700 (PDT) X-Received: by 10.52.118.73 with SMTP id kk9mr24275251vdb.13.1380652760241; Tue, 01 Oct 2013 11:39:20 -0700 (PDT) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id bp7si1614247vcb.82.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Oct 2013 11:39:20 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.50; Received: by mail-vb0-f50.google.com with SMTP id x14so5042276vbb.23 for ; Tue, 01 Oct 2013 11:39:20 -0700 (PDT) X-Gm-Message-State: ALoCoQllttdInEFAkYpnZTwHVvk+0jOa5RiAAFxTBoRlHzGTXUhpjqmTWfwff1q6pXEK9TEYQPjz X-Received: by 10.220.169.203 with SMTP id a11mr1805994vcz.26.1380652760069; Tue, 01 Oct 2013 11:39:20 -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 u4csp38620vcz; Tue, 1 Oct 2013 11:39:19 -0700 (PDT) X-Received: by 10.68.232.3 with SMTP id tk3mr31092388pbc.121.1380652759056; Tue, 01 Oct 2013 11:39:19 -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 iv2si5716627pac.177.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Oct 2013 11:39:19 -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 x10so7665949pdj.15 for ; Tue, 01 Oct 2013 11:39:18 -0700 (PDT) X-Received: by 10.66.218.98 with SMTP id pf2mr35638605pac.120.1380652758646; Tue, 01 Oct 2013 11:39:18 -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 ed3sm8282606pbc.6.1969.12.31.16.00.00 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 01 Oct 2013 11:39:18 -0700 (PDT) From: John Stultz To: Minchan Kim , Dhaval Giani Subject: [PATCH 14/14] vrange: Add vmstat counter about purged page Date: Tue, 1 Oct 2013 11:38:58 -0700 Message-Id: <1380652738-8000-15-git-send-email-john.stultz@linaro.org> X-Mailer: git-send-email 1.8.1.2 In-Reply-To: <1380652738-8000-1-git-send-email-john.stultz@linaro.org> References: <1380652738-8000-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.212.50 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 843504e..9dce86b 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;