Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755097AbcCBU0D (ORCPT ); Wed, 2 Mar 2016 15:26:03 -0500 Received: from mail-db3on0092.outbound.protection.outlook.com ([157.55.234.92]:38432 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752187AbcCBU0B (ORCPT ); Wed, 2 Mar 2016 15:26:01 -0500 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 v10 02/12] vmstat: add vmstat_idle function Date: Wed, 2 Mar 2016 15:09:26 -0500 Message-ID: <1456949376-4910-3-git-send-email-cmetcalf@ezchip.com> X-Mailer: git-send-email 2.1.2 In-Reply-To: <1456949376-4910-1-git-send-email-cmetcalf@ezchip.com> References: <1456949376-4910-1-git-send-email-cmetcalf@ezchip.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CPI:12.216.194.146;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(1109001)(339900001)(189002)(199003)(36756003)(11100500001)(4001430100002)(586003)(5001770100001)(50226001)(229853001)(5001970100001)(5003940100001)(47776003)(48376002)(42186005)(2906002)(50986999)(50466002)(107886002)(2950100001)(76176999)(4326007)(19580405001)(189998001)(19580395003)(92566002)(87936001)(33646002)(1096002)(5008740100001)(105606002)(106466001)(6806005)(104016004)(85426001)(1220700001)(81156011)(921003)(42882005)(2101003)(1121003)(83996005);DIR:OUT;SFP:1101;SCL:1;SRVR:DB5PR05MB1525;H:ld-1.internal.tilera.com;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;AM1FFO11FD008;1:U+EZ7F9wa+qzs8fgIB62TEZAaI9zy7T1D6M1kiz+IAKUa0N8vrx+1bW9V5VD0+pPjBjLf93eoZPi98FGY04OhTpE5/1dSvqCNpOIdAArROmIZGF02BEAfSid4RUwHOL+0rxLexKUzLLDv+HNz48d2vr69l31v4ekjjcdfCc7/sQ88elHPZ2IDnHYGi5xLSsSCnFiYXXD2d0eRDNp9ISi4HVcdZuit5d4h1Wvr/A452OVBGfK80pQp5pNA5d3XYaek/ZJ0/t54XsqNOGjCppWDqR+6XgfryUT54M4WWtb/4d9T3j/pkjz/JeZMS/i0mdzf5bmnW1EoPtQYCyKSiKwG99pwt40qbIKpn84aCijft7kfS96AD+GzuNP9KMcI24G+acS+tZ4nx/WW1Pq344mGBG1ZGwSGoOvcrbkk/XSVYDHxFUR39qdK3QULczYwRRVuximaIZCbSHpyIH/e/AHu0UoWHef0e+TgZXrTA93csBUbfyQGQiI1G42xpwp+9bO MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: aa73a973-215b-4c6e-06ea-08d342d6a326 X-Microsoft-Exchange-Diagnostics: 1;DB5PR05MB1525;2:0VVGwuuK/jVMDA/c6h0R4yl+4++gB73bJ5DZVeNX9yAGpY1V1fTginqCuYrPQnLREeHmUfTcwNCUtNEyy/oc6FMiSsUynSCmtCLUoZjRuFA56RMer4xgPz5HOOjq8QHTrTKKiPj5gaivv5KTvVaDFV/F/kRb3PLnX3wg3Y4u2EIxKZtrHG0wJuS2XM5AGMZj;3:ogOYSNANz4/3sb0VBL8Z6BaVl32s0FQzb1jdzj4t5WzrSFZPZds94fI6E/1YlFAEmPXvxMgwx/DEA0crt+TgMBZJtaPmqDtDO5PuWPXrLK+ShoaT484TtmqLbyMj49PMzgjKAOlRzTmR1UoUeGXTqjaGe5t8n4LhcFdCCuOUzDDoqfKO5c9KmR39qmV4fJb2;25:ub1gGUDvANhjnerv0PsqzVRQc04GZtRumAWwbq0HyHBFqAE66gI24hZh3/uMEzTkUR6L11QiRLcCp2jOa9LjBrVM1vXTNk5PDCgHyI6WCb6WqM46DzS2BxWU0JQT5gIN9Z+hOATjAtI7YuXqfaxgcsJWcE8ivpBxE8LoE1NM9K4IIYF/ULtS9wmOYgNWHLQaNjLuuB503S7F+WG6w6CbLVEbQ3GN+2AslWSjNwr0yqEmCyYpg3zOKYSX7pAD46pT0IHZpayziTtRs80rGv5hNE39F0Sz6by/C6FZ9wNHrJZ1g2m39D++AdPtZEVf32kUwStXYlC1SlHpjCeXH8yNDQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:DB5PR05MB1525; X-MLNXRule-EZCH-Linux: Rule triggered X-MLNXRule-Acc-Dom-4: Rule triggered X-Microsoft-Exchange-Diagnostics: 1;DB5PR05MB1525;20:f62ahcYG2JFMUzS7undYtzy+RtL8KC7dQuvM4RtQfRc9R1URy1c7FizLJnZkxFiAkScmRVInJeVxko17XqZgO7eF5Bitb6AiVF9m4dlPV5Hwz0p/kSmKnqi+oBFB67x52Hh9o+GQA2QvYkuAHWwPCNpTs6nxsHk7abAH4gX2zrNfuauZ2+ijGFc9Y/M6IVXoVnETveZsytonM3vZki6PDId+nqH8EjvECTifJ9MucriyCAt+L+F7PJp4o29FDqa+K4M2wVYZ0Itpla3plb22Hih6pLKtED0mTOy0J8VkNsIq9omKYn40lgIPQoN29F5lIlHQaxSgXhTO/UxkRBmlqy0Q/Ada04XPTROplN0ThCZOuuRyHR8Q7F/j19mW9tOVwveQll63DkIVhkJgkvQV6kzBQr8NhT3fccgwHH9e3l3cwjjHakGNMpqjHMRAjQvWFqUho53f32WCegy4zYjXkgS5wTAihIE5nBDJqxU2Og7iTUbXjLzwE/vqLPmcV46XefRWgJjwrr/ATY0kObX1GkUgnzxBvg0AqXtecqfrtm/CwodeiOt5wDpukR9PJbK1nkzEMrgs9HygAfblY77zrW7a3aCQ4mvaPQlg+p5Q1CI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13015025)(13017025)(13023025)(13024025)(5005006)(8121501046)(13018025)(3002001)(10201501046);SRVR:DB5PR05MB1525;BCL:0;PCL:0;RULEID:;SRVR:DB5PR05MB1525; X-Microsoft-Exchange-Diagnostics: 1;DB5PR05MB1525;4:TMaW8NBezixXGOOU7xx7lt42egQb5wkoAAFIl1o9B8EAeyLsc452zQiKZS/kW6fgXNnIYYnJYuF3dyoQjh00SNajwvMRpjT4fYy+1qB5v3dPLU3nZCE58FYQcOsPjD7k4AsocyasxoYpkjX3PQ3agWRAeyPQKqgdqZtmAR0ZHdNN8fCCyXCwCk3x+lq2xTD9VlY1xoLCdk/hAPm5+dQfM8eVRMFvkn5mREieaeNjjMgpoA5gXgrH46z7PpxGOa4efqfQky0avktFpqcw/xifaoYIbU5al9SnR9vCcI2KZYnQFFTDMY+5UDn0/qvJKRmfEHV7NPDK5S8OmLypjSJ/rjb5/2jx+r2rXw25C5cYw1vVTDjrk5UFIJavHI1POyuok72NPLtTrPE3j8IYA373ESfBt0iV5AYxgytcEhdfzAWph35beYgaxmMRxqO/he2XO8cEVsA78NCTK/JpvjKOfA== X-Forefront-PRVS: 086943A159 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;DB5PR05MB1525;23:Qk0c0nTEUYOaehAC7W0QN3lJmtV+S1okaavmo5hh4?= =?us-ascii?Q?tk/NMaTllg0pbqr6iMOO+w++kxDL5DFCJ/9YaEiYbcfNKdFwuj1X61UxSwuf?= =?us-ascii?Q?vPBwp9/aVG4mfH3FUho8gwa/Jm8/S3x1tPFVWM/1QlwPqHvJKCYQ+nFHIVfg?= =?us-ascii?Q?WBU6gDfNwhdob1ih4SQYgNC/yzqKfkbvxrQ1eWiPnR226sMBeo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dFRObxE8un2DIHd1h8N0n8z0RBc4VgQ7V?= =?us-ascii?Q?tSNkTkhelNRaWgkEbNFUTocfIJpDimBud+LnYoXFghwtZ/jw5GyBcD6HXjM8?= =?us-ascii?Q?mJGPxifp5VgDWc=3D?= X-Microsoft-Exchange-Diagnostics: 1;DB5PR05MB1525;5:WQjrwEr8hsiYDuY3Ywo4zVSkDYJ4k2lIwv3/KMG41qPnco1jJUod3cbt2/pnOXUU2yUfDANg3LiYCLRiru3v47sg82xgySVww42l+4ZF6pBKOij1Itzpe/lDuj1xmSEQe+nMw4tIlwFJ22o3HjCpLg==;24:JVonDNkyVCdrJcu4xPJHGuaz5/TNzYQBp2/70mkNaJakYlMk59FuzZQjH5Aiy319xPBFjOQ7jflNJVBgvldkWReaEKphVJ4WzjzwoyB24Gg= X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2016 20:10:01.2616 (UTC) X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=a652971c-7d2e-4d9b-a6a4-d149256f461b;Ip=[12.216.194.146];Helo=[ld-1.internal.tilera.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB5PR05MB1525 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1887 Lines: 57 This function checks to see if a vmstat worker is not running, and the vmstat diffs don't require an update. The function is called from the task-isolation code to see if we need to actually do some work to quiet vmstat. Acked-by: Christoph Lameter Signed-off-by: Chris Metcalf --- include/linux/vmstat.h | 2 ++ mm/vmstat.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h index 43b2f1c33266..504ebd1fdf33 100644 --- a/include/linux/vmstat.h +++ b/include/linux/vmstat.h @@ -191,6 +191,7 @@ extern void __dec_zone_state(struct zone *, enum zone_stat_item); void quiet_vmstat(void); void quiet_vmstat_sync(void); +bool vmstat_idle(void); void cpu_vm_stats_fold(int cpu); void refresh_zone_stat_thresholds(void); @@ -253,6 +254,7 @@ 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 quiet_vmstat_sync(void) { } +static inline bool vmstat_idle(void) { return true; } static inline void drain_zonestat(struct zone *zone, struct per_cpu_pageset *pset) { } diff --git a/mm/vmstat.c b/mm/vmstat.c index ff569246fcb5..e647628e84c0 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1480,6 +1480,18 @@ void quiet_vmstat_sync(void) } /* + * Report on whether vmstat processing is quiesced on the core currently: + * no vmstat worker running and no vmstat updates to perform. + */ +bool vmstat_idle(void) +{ + int cpu = smp_processor_id(); + return cpumask_test_cpu(cpu, cpu_stat_off) && + !delayed_work_pending(this_cpu_ptr(&vmstat_work)) && + !need_update(cpu); +} + +/* * Shepherd worker thread that checks the * differentials of processors that have their worker * threads for vm statistics updates disabled because of -- 2.1.2