Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758182AbcDERjJ (ORCPT ); Tue, 5 Apr 2016 13:39:09 -0400 Received: from mail-am1on0072.outbound.protection.outlook.com ([157.56.112.72]:14752 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751808AbcDERjF (ORCPT ); Tue, 5 Apr 2016 13:39:05 -0400 Authentication-Results: spf=fail (sender IP is 12.216.194.146) smtp.mailfrom=ezchip.com; mellanox.com; dkim=none (message not signed) header.d=none;mellanox.com; dmarc=fail action=none header.from=mellanox.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 v12 02/13] vmstat: add vmstat_idle function Date: Tue, 5 Apr 2016 13:38:31 -0400 Message-ID: <1459877922-15512-3-git-send-email-cmetcalf@mellanox.com> X-Mailer: git-send-email 2.7.2 In-Reply-To: <1459877922-15512-1-git-send-email-cmetcalf@mellanox.com> References: <1459877922-15512-1-git-send-email-cmetcalf@mellanox.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:12.216.194.146;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(979002)(6009001)(2980300002)(1109001)(1110001)(339900001)(189002)(199003)(4001430100002)(48376002)(36756003)(47776003)(42186005)(87936001)(2201001)(2950100001)(105606002)(50226001)(19580395003)(106466001)(5001770100001)(107886002)(11100500001)(189998001)(5001970100001)(4326007)(6806005)(104016004)(1220700001)(1096002)(85426001)(586003)(50466002)(19580405001)(86362001)(5003940100001)(92566002)(2906002)(229853001)(76176999)(5008740100001)(50986999)(33646002)(921003)(2101003)(83996005)(1121003)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:AM4PR05MB1683;H:ld-1.internal.tilera.com;FPR:;SPF:SoftFail;MLV:ovrnspm;MX:1;A:1;PTR:wb-fw1.tilera.com;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;AM1FFO11OLC009;1:dumZXX7ZY5jYQAvBeMp4bpLHj57cWiBI9fy9IatpP6GglpD+AfqwAJYc/W8KEyoou11QWwkM3JoJqQu6eDPjnCqzZklRT2sF7NKdLTyU/lx9RqEQXjrhYAbfsRZDn048lMj6f8t4H74Kqkasy5yQlR7q+P7WC68nOQmrHNWNkDYhLXQRoYjvS9xZdv+7EuM+9Ejii/Ww5PsmShuti9ZnKS7EQVjAkk8Zhvz06NhpuUKK9ipcnsYQU1rXr1nbB26mnwGK+mkKclZnDKR9YEEOYRRc8piVmBUlW13lVuyBFuoVXAn2OP5FDSpJoWzv3BJF5VYTEYJySYosdQjIBlVjP3rmfedeXILwAyAwJ+kNDVyq1QFveLNVueY7SQOm0dZfa82TmRV7JT9BQM0pzfY4XZdjdUnjH2Xwx0qrTe0NOXSrI0gZnRybpYcohPWA0VY1DlUd7mbEEfUrUYfr9bokqBlfTvJzRwRDLrafqrAaxoWZ3BQgNqs9v1FMnTW2BfMe5gJVGe6/EpnqiwR3931NdyiM2yifOoaEC6imIUHpL8e3rfg4/hySGvX6uTeFGJZ0K1ku1bdfIx2PecXBjlQgClMFMkENhCmd7TUU1RXID5CjsP4WWkFliT2U8o7McmlX MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 66b9f4b3-281f-44d0-a649-08d35d792c42 X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1683;2:fJeOeoEeATo6CUSV7ZvZYHL4BeIZ3nbKfavy60LZAVmrB8aP852LLobV9zP+Fc/5CdCni7gcWw7b7RPhDXJH3lmbnqxlD7s+3gf2b4hT+hGREhWlU/bsuUmtQqIPuNFf1hKPQH93QzA3biHyhCfCwGjcp2NbY538KNM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gpxiykPNzu+TxjScdStzmqD1/dQjmTsfZ6ys4sWJIrF83lP23cVxNYFfZLGNrIg3eZc/sO2LiAGLAoilnOGCfDzjGRD8F+4MYvFGNjQ9No27jIi8WxtVbghYCT3J9xfctZtRK+v6/qVLcm7WylQpRMzkOvAxjxi40rn X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13024025)(5005006)(8121501046)(13023025)(13018025)(13017025)(13015025)(10201501046)(3002001);SRVR:AM4PR05MB1683;BCL:0;PCL:0;RULEID:;SRVR:AM4PR05MB1683; X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1683;4:SX4Hvd0v8bI3c96DbTKFDvFrMVXaF035JT2D3JFH44bEX++oy7kAuPmRLtW+MGVQYg8MTHI2+wRB4cFvz29aUo0ua2A4Xtq7odEoBYO31jj7Zd/XyQ1EbI6xKHWjBzWPG7aBlc9GGXU3XkH7HrgoxZNnd8+w25ETUoUc/ATVwd/307M3xxRyLqlDiHfc9zyDrCEdLVj+N4T9WwkEecGKq2H/LdPwHvVlVILxXDPWoJr8usCp99YU0Txc+bs3Tvaa+zxHDJjDhqWUKz6orNkT7q+I33NAdZPPQpiNBW+dtafp4FoALXUtDZIfZwg/jY54iDOm18rMW6z3dYtroVN5H48AJLG5Tkoy0ahwzIlkU77ZeRPaw+tTVITKjFmiUjOL08yQWnnduv+gf47/tW0G0DKuRurmVbncMrzJmO7rymnSvNVHkqsCjL1nZC1ywcpssMxVhe0YI/WNnO8m/dY1FA== X-Forefront-PRVS: 0903DD1D85 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM4PR05MB1683;23:t3FCfu7NwUA1YXuGxT1fG0P3D+7DViV7sC0+Y8Mff?= =?us-ascii?Q?+pmlWFYciFN8APa/fGIQ0yHDMVWIy9ZlK9+0t8pngxc7d2BeV1QpREFbQG6v?= =?us-ascii?Q?2PmUR8Ja8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/icgVSgS?= =?us-ascii?Q?hUlQcZeeHLnRecJakL/iL20bAQB5KkA1T8TircUyBgO2p50H9gNCZ51fyWCG?= =?us-ascii?Q?2Q4v5arm0pohLEWzyaooPpdNxjLCrSitVZ+tn80wCwtPxi6j/QtVyE5JY/mw?= =?us-ascii?Q?yFTvWqYKo61DL2Cb5INlOfe5MqbR2M09oILWCy2XuMbuVp2/lHJ4saqofyne?= =?us-ascii?Q?24zSnzjecgxOhETa1wJZGb/+RuU9RQI5GmumZvKVhxLOW6e1hGP5ztFNA+Gu?= =?us-ascii?Q?rxUi8/dgtR60AASkaeimCRGwEDifDQIEnvnvS0fp84eqd7Uj1/7LUV16QBmj?= =?us-ascii?B?QT09?= X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1683;5:zhVMN5K+7nUqzDZrsnLMKyQi9Y5OcfhddNeGh9HrsMJIrqYihN1tEHakHwri+VqimQkypn9f4jvIGgzmFa9QB8IfMtLxEGB3FLfdatf1ydyGs0p/75rq5U7km4iinMQJWoiM+0xXdy9mV05AAMzT9g==;24:DH2hrk/unTZ5hJjlE2tA9OfXGPyCrFk22t4O2tJcGl3khKiuvS2ULTYVDtSzkCu0M9kLpUHQQ37AH/78jC4qjagB+TkAH99yiAYi22lRv7w= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2016 17:38:59.9995 (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: AM4PR05MB1683 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1888 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 7a1cfe383349..fa34ea480ac0 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1469,6 +1469,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.7.2