From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755321AbbJ1CmS (ORCPT ); Tue, 27 Oct 2015 22:42:18 -0400 Received: from resqmta-ch2-08v.sys.comcast.net ([69.252.207.40]:55228 "EHLO resqmta-ch2-08v.sys.comcast.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755215AbbJ1Clf (ORCPT ); Tue, 27 Oct 2015 22:41:35 -0400 Message-Id: <20151028024131.512101613@linux.com> Date: Tue, 27 Oct 2015 21:41:15 -0500 From: Christoph Lameter To: akpm@linux-foundation.org Cc: Michal Hocko , Tejun Heo Cc: Tetsuo Handa , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org Cc: hannes@cmpxchg.org, mgorman@suse.de Subject: [patch 1/3] vmstat: Make pageset processing optional in refresh_cpu_vm_stats References: <20151028024114.370693277@linux.com> Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline; filename=vmstat_do_pageset_parameter Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a parameter to refresh_cpu_vm_stats() to make pageset expiration optional. Flushing the pagesets is performed by the page allocator and thus processing of pagesets may not be wanted when just intending to fold the differentials. Signed-of-by: Christoph Lameter Index: linux/mm/vmstat.c =================================================================== --- linux.orig/mm/vmstat.c +++ linux/mm/vmstat.c @@ -460,7 +460,7 @@ static int fold_diff(int *diff) * * The function returns the number of global counters updated. */ -static int refresh_cpu_vm_stats(void) +static int refresh_cpu_vm_stats(bool do_pagesets) { struct zone *zone; int i; @@ -484,33 +484,35 @@ static int refresh_cpu_vm_stats(void) #endif } } - cond_resched(); #ifdef CONFIG_NUMA - /* - * Deal with draining the remote pageset of this - * processor - * - * Check if there are pages remaining in this pageset - * if not then there is nothing to expire. - */ - if (!__this_cpu_read(p->expire) || + if (do_pagesets) { + cond_resched(); + /* + * Deal with draining the remote pageset of this + * processor + * + * Check if there are pages remaining in this pageset + * if not then there is nothing to expire. + */ + if (!__this_cpu_read(p->expire) || !__this_cpu_read(p->pcp.count)) - continue; + continue; - /* - * We never drain zones local to this processor. - */ - if (zone_to_nid(zone) == numa_node_id()) { - __this_cpu_write(p->expire, 0); - continue; - } + /* + * We never drain zones local to this processor. + */ + if (zone_to_nid(zone) == numa_node_id()) { + __this_cpu_write(p->expire, 0); + continue; + } - if (__this_cpu_dec_return(p->expire)) - continue; + if (__this_cpu_dec_return(p->expire)) + continue; - if (__this_cpu_read(p->pcp.count)) { - drain_zone_pages(zone, this_cpu_ptr(&p->pcp)); - changes++; + if (__this_cpu_read(p->pcp.count)) { + drain_zone_pages(zone, this_cpu_ptr(&p->pcp)); + changes++; + } } #endif } @@ -1363,7 +1365,7 @@ static cpumask_var_t cpu_stat_off; static void vmstat_update(struct work_struct *w) { - if (refresh_cpu_vm_stats()) { + if (refresh_cpu_vm_stats(true)) { /* * Counters were updated so we expect more updates * to occur in the future. Keep on running the