From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161059AbcA1Phq (ORCPT ); Thu, 28 Jan 2016 10:37:46 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:36155 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933921AbcA1Phn (ORCPT ); Thu, 28 Jan 2016 10:37:43 -0500 Date: Thu, 28 Jan 2016 16:37:41 +0100 From: Michal Hocko To: Christoph Lameter Cc: Mike Galbraith , Peter Zijlstra , LKML Subject: [PATCH] vmstat: make vmstat_update deferrable (was: Re: [PATCH] mm, vmstat: make quiet_vmstat lighter) path cycle muncher (vmstat: make vmstat_updater deferrable) again and shut down on idle) Message-ID: <20160128153740.GD15948@dhcp22.suse.cz> References: <20160121165148.GF29520@dhcp22.suse.cz> <20160122140418.GB19465@dhcp22.suse.cz> <20160122161201.GC19465@dhcp22.suse.cz> <1453566115.3529.8.camel@gmail.com> <20160127164825.GF13951@dhcp22.suse.cz> <20160128153111.GC15948@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160128153111.GC15948@dhcp22.suse.cz> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu 28-01-16 16:31:11, Michal Hocko wrote: > On Wed 27-01-16 12:26:16, Christoph Lameter wrote: > > On Wed, 27 Jan 2016, Michal Hocko wrote: > [...] > > > +void quiet_vmstat(void) > > > +{ > > > + if (system_state != SYSTEM_RUNNING) > > > + return; > > > + > > > + /* > > > + * If we are already in hands of the shepherd then there > > > + * is nothing for us to do here. > > > + */ > > > + if (cpumask_test_and_set_cpu(smp_processor_id(), cpu_stat_off)) > > > + return; > > > + > > > + if (!need_update(smp_processor_id())) > > > + return; > > > + > > > + /* > > > + * Just refresh counters and do not care about the pending delayed > > > + * vmstat_update. It doesn't fire that often to matter and canceling > > > + * it would be too expensive from this path. > > > + * vmstat_shepherd will take care about that for us. > > > + */ > > > + refresh_cpu_vm_stats(false); > > > +} > > > > The problem here is that there will be an additional tick generated on > > idle. This is an issue for power because now the processor has to > > needlessly wake up again, do tick processing etc just to effectively do a > > cancel_delayed_work(). > > Thinking about it some more, making vmstat_update deferrable should help > to not interrupt idle no? With the full changelog >>From 89858bf594c020f065b4f415a12d75bee64a7954 Mon Sep 17 00:00:00 2001 From: Michal Hocko Date: Thu, 28 Jan 2016 16:31:43 +0100 Subject: [PATCH] vmstat: make vmstat_update deferrable 0eb77e988032 ("vmstat: make vmstat_updater deferrable again and shut down on idle") made vmstat_shepherd deferrable. vmstat_update itself is still using standard timer which might interrupt idle task. This is possible because "mm, vmstat: make quiet_vmstat lighter" removed cancel_delayed_work from the quiet_vmstat. Change vmstat_work to use DEFERRABLE_WORK to prevent from pointless wakeups from the idle context. Signed-off-by: Michal Hocko --- mm/vmstat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index eb30bf45bd55..69537d2be6f6 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1512,7 +1512,7 @@ static void __init start_shepherd_timer(void) int cpu; for_each_possible_cpu(cpu) - INIT_DELAYED_WORK(per_cpu_ptr(&vmstat_work, cpu), + INIT_DEFERRABLE_WORK(per_cpu_ptr(&vmstat_work, cpu), vmstat_update); if (!alloc_cpumask_var(&cpu_stat_off, GFP_KERNEL)) -- 2.7.0.rc3 -- Michal Hocko SUSE Labs