From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753295AbbJTUgf (ORCPT ); Tue, 20 Oct 2015 16:36:35 -0400 Received: from mail-am1on0060.outbound.protection.outlook.com ([157.56.112.60]:48544 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753183AbbJTUg3 (ORCPT ); Tue, 20 Oct 2015 16:36:29 -0400 Authentication-Results: spf=fail (sender IP is 12.216.194.146) smtp.mailfrom=ezchip.com; ezchip.com; dkim=none (message not signed) header.d=none;ezchip.com; dmarc=none action=none header.from=ezchip.com; From: Chris Metcalf To: Gilad Ben Yossef , Steven Rostedt , Ingo Molnar , Peter Zijlstra , Andrew Morton , "Rik van Riel" , Tejun Heo , Frederic Weisbecker , Thomas Gleixner , "Paul E. McKenney" , Christoph Lameter , Viresh Kumar , Catalin Marinas , Will Deacon , Andy Lutomirski , CC: Chris Metcalf Subject: [PATCH v8 01/14] vmstat: provide a function to quiet down the diff processing Date: Tue, 20 Oct 2015 16:35:59 -0400 Message-ID: <1445373372-6567-2-git-send-email-cmetcalf@ezchip.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1445373372-6567-1-git-send-email-cmetcalf@ezchip.com> References: <1445373372-6567-1-git-send-email-cmetcalf@ezchip.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;DB3FFO11FD054;1:Ewvab2qxJGsUAchBdIPGHW8UUTX9hdA39UYwu3LCclZZzltU7Rc8Af2hN5YC9FOamSWUjnd3ZFypat8V4r16mIZ4WsG2XhI6eSQ9AM0jOv2VdnXBYh/1G/otJATCXubeFhuKNH+vAWGkYOAzCIroB+75JNqo0eHC7ihFtzP7JflDT0DsYOIExLNMDH5DNPP+Hres/3n0JflP4reSTPPK5AlD6yu2SbfYjqtqi3yUCAkhqHTsJ3AxOq/QNZPmFdaNxvWNUCpsKAnxIHuHfZg123l6JtBVD8krBD0obvvCuyDeBavPibDXhMZYvlvoXonWL+0LRCaqoLcskVx0J2PaU4mLSSe/ef9r4sTMUD/n54A= X-Forefront-Antispam-Report: CIP:12.216.194.146;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(2950100001)(107886002)(97736004)(104016004)(5001960100002)(5007970100001)(50466002)(81156007)(6806005)(11100500001)(87936001)(5001770100001)(5003940100001)(48376002)(86362001)(189998001)(19580395003)(19580405001)(85426001)(64706001)(106476002)(106466001)(105606002)(50226001)(106356001)(229853001)(92566002)(36756003)(42186005)(47776003)(33646002)(76176999)(50986999)(5008740100001)(46102003)(9376005)(921003)(1121003)(4001430100001)(2101003)(83996005);DIR:OUT;SFP:1101;SCL:1;SRVR:HE1PR02MB0780;H:ld-1.internal.tilera.com;FPR:;SPF:Fail;PTR:InfoNoRecords;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;HE1PR02MB0780;2:7GZ1Dnw1ecTyUINJOn9qyvsdoLDkXFZZxxNmvABuPsgmRN/nM0sQDnUigy3lifIEK+/jQc3yap3o7T3sX3UGJB5Juv5cf1e1FmOJWXSn+AKgulazHo9zadNHpuXzm0X85+VUtz/v5EAwJx6XtsEDH4vOgjwaKl0M5Wweh57fHmU=;3:m8eYX6p+HqS6Tb4edHrJt0fyJzjpGqI20aRAi2Ebt731LHzlTnYIeK2f1J+wKusg7l4P1l1Uj0EGpdn5lm5yNaVsUrwYnK0Au8d+O9BB3xxX2WLxAR9h2Vs8dv73m1uk2bXQiFVLnIetOxCPW49BC+SHPd0YS//kHnxAcJDyxK8x/WbhWgpz29M32gqxfII8x0/YiWGodiZtPuwX2Zs4puN5jRqcuuCirrtONcGe52wb6JSvMccPpPLu5VzXNiJR;25:fEuTBTR+ue86CCOcI+CSWMbbCnSuBymxRaLna+qzRHRhsgBxujWJhbLofeImXpKdOe4iFB3vjfGr6ktbk4F3pU1hCsoOIkQDC49sWZK1FWYfdpNcjzTknqjAEljVq/RPsPW0m2MynKBbiWJAskaS6QQpXiOWI3/tKEJLbOaWKpOM0vMdcsQwqevfZQ36px6oZcAnT2W0Cao+/PBDwvIa7dJYzHB4dnf0XoTaFlyIRTl0gGgyIqh8hP4EEPDwjVg0u/xhcz5u7YRElOcqhAroMA==;20:sHrYd4H6JMPRNMIKCPL1kO++TrK4g8/JQUaZK5oq0H1rF5bVmeuOIVKohARUjJd/h3bNiAeVp2oB5v1efkpfusuLR4nKHUkeXNloL699uejFZq14l2B72ml6/dcYU+osJXBBKI6j90ol2sSnP/T5qJkjLkCOQ20nRfLGQF87a1g= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB0780; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(121898900299872); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(5005006)(520078)(8121501046)(3002001);SRVR:HE1PR02MB0780;BCL:0;PCL:0;RULEID:;SRVR:HE1PR02MB0780; X-Microsoft-Exchange-Diagnostics: 1;HE1PR02MB0780;4:OOukJc0SmiaIcWQ+Ew6zwOAv62PKab4eLznsCIBZL7wnoxP2TxeyMrxGU4M78A1HJhYjCyhqdm6hMlkOYYSJC1MbS0haud7FmfSGN1hJF+/pn1/1WVJKLOVRlpszo+zvUspkKzlkJjE1cwamc5hX5iew95v4Td3v9VLga8zp2aYXEi230/F1Fdvly1YwL0FoioJvpMXF9XEWrD30M0l+oeRHLzma5OuE0oI2zpQUHeqhCrSHrepstMItLZFhA/wfAvmwtEonk3zCOiiPRrI6JMHOsayucm6BiyB27LSAu41MWG7dlZ1XC9dn6OyDY5U3djRk4xVoWOcoHgQoHFAEBCWQh1y4ZQ8mM5NYpmAw7uI= X-Forefront-PRVS: 073515755F X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HE1PR02MB0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/sA2O79eC?= =?us-ascii?Q?KC7IsJBkHTlCoJEzScXd1MlWJBmEzstXys88zOVB2KL0Fz7MzEte78DSZxrh?= =?us-ascii?Q?AHWrQl0U5msqkn5Hx1hTPqsM/QwaUASk9bq8KbLF1LmTmY6HNRSUoVj+Z7IM?= =?us-ascii?Q?Krz013DA2vqZtZon6XynnaiEJOXAfbQGlBAj9IMwICe7lCFnVtKkQ+8odyDS?= =?us-ascii?Q?3Dk2qTAVZryaHqN9F/4nCF5h+ZKEklennSb+Jp8YwrG9N3Jf7Vy3sWL57U05?= =?us-ascii?Q?Dpk2q0JJAVwcM9D7+OlKnobuzVXqDhwMA/h5J82Wln+tRqFP7lHQ1V8ErWth?= =?us-ascii?Q?xUDJMeKnMfelKYnTxy7U2cGu6GWAR0QZgF1Nqg5M1audda8umHSlOo3B7PGl?= =?us-ascii?Q?pILKiDYG+XPckcONKMRlyWYovpt0k3c3Z1ijYN5?= X-Microsoft-Exchange-Diagnostics: 1;HE1PR02MB0780;5:aG+0P3ZH+Riw31jijEm3OLnjwBoO+hGl7U3PxxK2mE4GgTufSzitUEIGTnGt/heicBG/T4+o2oI2JcHcFXU/GHhTfvEiPBrYzaoFZ8Q88VojP+ajXGlipIDTVI/Xd+9TJjfzV/HX1C1elB8qkV0sMA==;24:vhoDABErKUJxs9HC9wxMwVghFbqqivajN84n82tfeWZqh2m2TtpzdFcVn0fkQfPfD3YqG91l+iRjehCWOQSAxjpXF0A4mayv/BhoksMeJ7I=;20:xpqY8+1aCJnDmxtWj32hv7wlGLraZuvceX1xuJLJVdH9XFqixOlY2/8MbdV6x/toxo2MwduMHpXgCtiINYOTPg== SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Oct 2015 20:36:24.8979 (UTC) X-MS-Exchange-CrossTenant-Id: 0fc16e0a-3cd3-4092-8b2f-0a42cff122c3 X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=0fc16e0a-3cd3-4092-8b2f-0a42cff122c3;Ip=[12.216.194.146];Helo=[ld-1.internal.tilera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR02MB0780 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Christoph Lameter quiet_vmstat() can be called in anticipation of a OS "quiet" period where no tick processing should be triggered. quiet_vmstat() will fold all pending differentials into the global counters and disable the vmstat_worker processing. Note that the shepherd thread will continue scanning the differentials from another processor and will reenable the vmstat workers if it detects any changes. Signed-off-by: Christoph Lameter Signed-off-by: Chris Metcalf --- include/linux/vmstat.h | 2 ++ mm/vmstat.c | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 82e7db7f7100..c013b8d8e434 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -211,6 +211,7 @@ extern void __inc_zone_state(struct zone *, enum zone_stat_item); extern void dec_zone_state(struct zone *, enum zone_stat_item); extern void __dec_zone_state(struct zone *, enum zone_stat_item); +void quiet_vmstat(void); void cpu_vm_stats_fold(int cpu); void refresh_zone_stat_thresholds(void); @@ -272,6 +273,7 @@ static inline void __dec_zone_page_state(struct page *page, static inline void refresh_cpu_vm_stats(int cpu) { } static inline void refresh_zone_stat_thresholds(void) { } static inline void cpu_vm_stats_fold(int cpu) { } +static inline void quiet_vmstat(void) { } static inline void drain_zonestat(struct zone *zone, struct per_cpu_pageset *pset) { } diff --git a/mm/vmstat.c b/mm/vmstat.c index fbf14485a049..a9c446353c7e 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1395,6 +1395,20 @@ static void vmstat_update(struct work_struct *w) } /* + * Switch off vmstat processing and then fold all the remaining differentials + * until the diffs stay at zero. The function is used by NOHZ and can only be + * invoked when tick processing is not active. + */ +void quiet_vmstat(void) +{ + do { + if (!cpumask_test_and_set_cpu(smp_processor_id(), cpu_stat_off)) + cancel_delayed_work(this_cpu_ptr(&vmstat_work)); + + } while (refresh_cpu_vm_stats()); +} + +/* * Check if the diffs for a certain cpu indicate that * an update is needed. */ -- 2.1.2