Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758755AbcDERnx (ORCPT ); Tue, 5 Apr 2016 13:43:53 -0400 Received: from mail-db3on0098.outbound.protection.outlook.com ([157.55.234.98]:2931 "EHLO emea01-db3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757451AbcDERjH (ORCPT ); Tue, 5 Apr 2016 13:39:07 -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 03/13] lru_add_drain_all: factor out lru_add_drain_needed Date: Tue, 5 Apr 2016 13:38:32 -0400 Message-ID: <1459877922-15512-4-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)(6009001)(2980300002)(1109001)(1110001)(339900001)(199003)(189002)(104016004)(5008740100001)(106466001)(92566002)(48376002)(586003)(47776003)(87936001)(50226001)(2950100001)(5003940100001)(960300001)(11100500001)(2201001)(6806005)(85426001)(105606002)(19580405001)(19580395003)(33646002)(50466002)(2906002)(76176999)(42186005)(4326007)(86362001)(50986999)(189998001)(1096002)(1220700001)(4001430100002)(229853001)(5001970100001)(107886002)(5001770100001)(36756003)(921003)(2101003)(83996005)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:AM4PR05MB1682;H:ld-1.internal.tilera.com;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;AM1FFO11FD038;1:oQyby2H5EcX22AgCCywLvEXk49wO1wgUSEQlaefMo2tBB+cF1SCcirL/nS2kXbzlLR/9XEZJ/lGpnWxL5n8xLatBPujY4fRX8mM/+4GIrdKPkT+RpmttqROO8plYbif3ZyoXC3utQOa8Ad9fPYgSxVMsQl93hdB/gGx+vrZ31PusPsClf84S7MGGeegvvpnAdG/qo2K5aAtddNVTFBb+f4osp1xr775WIbqP0KJUVQ7ixITre+PmVMIH0DrQGbNBvo3fy2Bl0wIpqx7oUbRePPI3Z2Pc11Z7LdCyHDeSGeRyjPGMx1vXKC1WJmyyAttHdww6JipbftJM/2N+p1mBHsHtTEFgQ63A7KNdWVrovR8dWMMiqRO08hpfNzmWZSnCuopnBwYfLFfRZuRH0GQpePgCG0zRbB14Mf6v+gf9+dsvZHuO0jNw02mTOTuBJhkD9Q/ABQZAhv/UDs9Lc+io4Knn7ImlmGOkC3w6BOGLL4FDn0HgyQzN/TEoiI2HS2tmSP9+fx1xqnMDLTmtBCUsLKa22RV4AoTysjcR8h84HFOWxD3yUyMKgNrLMyexbnhT5EFlZL2a/U6JLh2CZJj02MuG7yFBPIqSw8HKYsgddy4wVtRtm8/83uzWTqlH95/G5pOzFn6C6LJOD8/0TOI8ow== MIME-Version: 1.0 Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: d1423591-6206-4120-c85c-08d35d792dfe X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1682;2:GZYbUISjMM+fBnkkYiXI4bocWGMyNnoxBgUEIJ6SreZkQaYvSziIsJCzmenERNGJ/VTTfo8jeqt+tD1cjaLtTJQEiovV4V3/swN3+W0u9hwd/TAEp3n5Yau0WVFz96R7TNMq3gx5urrgW8632Hs/zZ1wVeAtXV9w3T4dkDzXnQMbVYGfFy100U3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P2xm4k8lP5LKeJ9HV066hyv+bWX0aXLBqwAsqCBrSDl9AbbDg+PInEX6mm2s7a19MMgLvvvYEowBiVEJCMmrMNsl8JQ793ZhfSQvGiQQjvcktfdgd6usZz5NFGwhaNwHaprgs7unV/JJy 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:AM4PR05MB1682;BCL:0;PCL:0;RULEID:;SRVR:AM4PR05MB1682; X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1682;4:/03AUvbmJcIhOGe75uqsLIiVK/hWaqrZ2XHorvmBSrDyLVRodCwCM7WlFvQcETkE9oEY/mhP42GQ29RitbFA6gWjxc1mI3xjfu6qsWwykW7O+886wLssYkriWDne52sv9O+qVuAaD25XpPgxeo9LypBK24RjAh+NdfaWSW/EDN+rf+d9jxqRr7VeE7Pixbr4PPAztOoZyGEqfSuHQaPHuJXbzdncJd1sDQK3hgkcX9sSNIR2rehRQ1UbxAZ9hi7LRR2il+YsKoPY6n1cFCAjuct2a9z6Leul921AjaefTYArjx2of62/nFXm6FCn/JaFSbMuTtNp0WftO7d6nhN19jBqhy9OFWJ2BCa0XE9Rvpk3160O46dBPkOnkJgKkXg5Hy1GV5lJQ82MlwR2uDuPMOcCzJGPwQwHzpz67hdiU0CIEddIc0BQpJecRpsrqqbcBIV370LhnsRwBWyqFAmESA== X-Forefront-PRVS: 0903DD1D85 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM4PR05MB1682;23:XM8c7JDdzbEqrDvoyLczpUWtOJ12pvAGN7boRr04a?= =?us-ascii?Q?sj+ttodb7gtK4NWGPpLS+JcSal0pF/dVYvcFEWwYXtQqsp74UXaQshIJDZd8?= =?us-ascii?Q?iB9tRiIYsMKE8XMPYzIP+QD0Oicg0xqqrrRKLMXydwhmV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7Q2PzW9ylg2+ABXQgyj68zdNzBSloqY+Ijlvbv6NQQIX?= =?us-ascii?Q?12JGPRVeslz2z61d4hDuY4Qe9EazvmeGHzrB+3MgH8aoeHUZ0Irk0tP8rn1u?= =?us-ascii?Q?NWo+VPvZ09iqUlU8LpxBAwObfl8+w6qpWKv5ylDkOfTZ0e6x935NiJsM4H3V?= =?us-ascii?Q?Y8gXoKcG3Gdzwy+13QE2x/JAbUqx02RVYo5PHANfLZSKJjokYNMDloymA=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1682;5:rBD9qfFGp2Pb9Dkar5aXvHq1E8KuRqjkNpvWAaKJZ/GJ11Snlkzelz4L7lCMGuRSoX8riiaqJMvl29Hq5sO9VKt4ywHyWC7D/Cpbgvpayy2aPVoRXmslOGAafXQ9ZsPMLCwImPPv2AdCSEsh7vOKXA==;24:6/fECwgt4rpmv8K4zSydvpt57euGLPowUUwi/8LooSewhsxaL9ciCrrvjHcXyFKt3vG400I0E9+qCLkzSTofk9xm/7i6PyevU2a4qyPBDAA= X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Apr 2016 17:39:02.9258 (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: AM4PR05MB1682 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1999 Lines: 57 This per-cpu check was being done in the loop in lru_add_drain_all(), but having it be callable for a particular cpu is helpful for the task-isolation patches. Signed-off-by: Chris Metcalf --- include/linux/swap.h | 1 + mm/swap.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/include/linux/swap.h b/include/linux/swap.h index d18b65c53dbb..da21f5240702 100644 --- a/include/linux/swap.h +++ b/include/linux/swap.h @@ -304,6 +304,7 @@ extern void activate_page(struct page *); extern void mark_page_accessed(struct page *); extern void lru_add_drain(void); extern void lru_add_drain_cpu(int cpu); +extern bool lru_add_drain_needed(int cpu); extern void lru_add_drain_all(void); extern void rotate_reclaimable_page(struct page *page); extern void deactivate_file_page(struct page *page); diff --git a/mm/swap.c b/mm/swap.c index 09fe5e97714a..bdcdfa21094c 100644 --- a/mm/swap.c +++ b/mm/swap.c @@ -653,6 +653,15 @@ void deactivate_page(struct page *page) } } +bool lru_add_drain_needed(int cpu) +{ + return (pagevec_count(&per_cpu(lru_add_pvec, cpu)) || + pagevec_count(&per_cpu(lru_rotate_pvecs, cpu)) || + pagevec_count(&per_cpu(lru_deactivate_file_pvecs, cpu)) || + pagevec_count(&per_cpu(lru_deactivate_pvecs, cpu)) || + need_activate_page_drain(cpu)); +} + void lru_add_drain(void) { lru_add_drain_cpu(get_cpu()); @@ -679,11 +688,7 @@ void lru_add_drain_all(void) for_each_online_cpu(cpu) { struct work_struct *work = &per_cpu(lru_add_drain_work, cpu); - if (pagevec_count(&per_cpu(lru_add_pvec, cpu)) || - pagevec_count(&per_cpu(lru_rotate_pvecs, cpu)) || - pagevec_count(&per_cpu(lru_deactivate_file_pvecs, cpu)) || - pagevec_count(&per_cpu(lru_deactivate_pvecs, cpu)) || - need_activate_page_drain(cpu)) { + if (lru_add_drain_needed(cpu)) { INIT_WORK(work, lru_add_drain_per_cpu); schedule_work_on(cpu, work); cpumask_set_cpu(cpu, &has_work); -- 2.7.2