Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756052AbcCBUMa (ORCPT ); Wed, 2 Mar 2016 15:12:30 -0500 Received: from mail-am1on0077.outbound.protection.outlook.com ([157.56.112.77]:27072 "EHLO emea01-am1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755060AbcCBUKU (ORCPT ); Wed, 2 Mar 2016 15:10:20 -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 03/12] lru_add_drain_all: factor out lru_add_drain_needed Date: Wed, 2 Mar 2016 15:09:27 -0500 Message-ID: <1456949376-4910-4-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-Microsoft-Exchange-Diagnostics: 1;AM1FFO11OLC003;1:Ng0ttFo0CJoaQcqUeGmEOOJG/jQX7ET7+o2nRJkn0dUInYXzXXyrGAIU854Rb/YT8pl3Qg5TpLZUDQa9eNs/NrOEfJapwK9dYVoJyxIQCx5A3igabiDqMZ6en0rnWgWjNw87YUUEffyMiwgRLCvfXr4e44kQfI1MkMptxgLYuBctatgnKqZ69ZzB8ipLdsalpf9JrJxkneEfB3EdWNk7744l1Z7GeXqkzQ8BpUXBSANDNGoPoX5lI1Nzvye7+jJcsQlDJEa4aMOPVnTXClhas+lvPvz9qBfMONTyRf0O9JMrlFfQXPLVIyI1MFD8D9RqWkKX/mR5iK+hRgS3DcR+MeSeSLp5+IEQPHnmOOmPwi2kDOzrkHm3GUa9KKz5aEdmuNZeiTnGda9g8P+5LKefFouFvgVUXJxMnHjIFStJF9gR5MBqz/oLw4wXvivVPRe5CHiX67CzY7Luk1Gc33TSTIwwBGDQZyEqMoogY0zZ7YU= X-Forefront-Antispam-Report: CIP:12.216.194.146;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10009020)(6009001)(2980300002)(1109001)(339900001)(189002)(199003)(50226001)(85426001)(36756003)(2906002)(1096002)(189998001)(1220700001)(586003)(42186005)(105606002)(87936001)(81156011)(2201001)(106466001)(47776003)(50986999)(5001770100001)(76176999)(92566002)(5008740100001)(104016004)(50466002)(19580405001)(4001430100002)(19580395003)(6806005)(4326007)(48376002)(5003940100001)(107886002)(229853001)(2950100001)(5001970100001)(33646002)(921003)(42882005)(2101003)(1121003)(83996005);DIR:OUT;SFP:1101;SCL:1;SRVR:AM4PR05MB1524;H:ld-1.internal.tilera.com;FPR:;SPF:Fail;MLV:sfv;MX:1;A:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1524;2:koF0ORCBdlUmXROMMDZsaYKRP/9DRNrDD9u6fcLQSYzQGO4iVtYapGkZ14HZ2Jsc0Quj3EcYuq7507gtnj786OxOxqO/BtP2tLzBAutEYNQ2jYMpO9uGWRYyk4Kw38lCL9tkODxv/hs/TN5iVqDasQ==;3:5KiBaTZf4CZpnk3vr5rxULF6FvYm3ntGqXcRYDDGVnmhAM1mzyzbSSA4EkJISPqpjl6i25TnlV+u+M7N4gS14zjvvFOlnUYnqGaJScajB3g0vFVYZxYq1Y3gBPdHeI0aYWr5qgMpNXbag0TVbQ8o1JuvLgSueBDfS0tqmPLkIwZGWDkCsCUOiU8J+kRoNsEVq6pcuCMfDm6hal9TO79L08sSJY86E9WuZRIv5TbXsSg=;25:zFE+Yqil2yqUYRoNhGN3n350fuMRbjp70ayuNeHDTwRRpdjCZfeJ9AA4I63SjmJd6AiN8B/VQPSaqqpOxGmCJjpj8T/mz8/PJ55D6cPJ6lbODeik98rkESOBs1Fr62+k0ss5z5gdDbuzCM668aoh9IDjjiSfQ+lbBDzMB8VvMYeYqcsFOFHkfW/wTBye91bA3vMzfSRs7KG3DbtkFe3Dn5CHw8gAzfQTwPojXSANrrfRfW8jL7b6Y9X4cg4zB0PI8kucWaOiv3BLq4dwmCIb/Ge4xqemkN5maGx3lj/cxjyZB7+vPJyC4AcR2XGz89z36CI1Q8uIl2suH/SukFt838nwxUC6F9kxJMDC3aDjfBJiZGNXQvq+v1R6abgwx9/P7l2eYx7tRGtkVgREHebaUg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:AM4PR05MB1524; X-MS-Office365-Filtering-Correlation-Id: a5630563-c60b-49f8-b0d7-08d342d6a590 X-MLNXRule-EZCH-Linux: Rule triggered X-MLNXRule-Acc-Dom-4: Rule triggered X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1524;20:hbDRj9u3n4yQVnag7PxLjuemz21gNWAD6brlxKxQJ4v3Nf3vW64/hZbZsxdI1tdA3OJ/LetpEBv6Qv29uf3zqZc7y3RBkftUdyqv9sEauOyXN9+96x9fPISuN+PcW+suvJdWV6zDuPdnKnPnH4e5G0Qe0+s/8ZX5N+4Y3wGpOWd9k69ZpsoG/uBRSMI441TZRHNods9kLfpn+fH3xl1GHHczbyRvt2pAvPl6KXcH+BoTmusiiFrw3HAb56cMCw+sCMIALzampsc/UDRpPRdAL1PANXkfrAAU89dZ8gXm9DxTgxNRa2/RjazRo+3RWNru4+BcvP+ocmBYj+aSm4IPH+SeEETlHAM8Qg7fB7W4ltQOCmHkpvC5hYj24QqFMLnJUP9Py1mXMQ0vLJYWX99euKbo1jvq2TBk2CltGnzHvC8WLgv+VoFT5sx6E/0sywAy9GAt5sgV05SJKcx2VVXsFs+aWYZhHV5Rme4PcZ1VRop/4s8FT5YuD0EvAUgaRgcZVIlLDcWMlkAQvfFDfNx9FWXdIdPMJseMu0Tzi5q47sA5WVO/JJhtWijEZb3I07RKd6PiY+REsancOcbG4LsKY+jrzNuzSzmUaPO1oKxls7I= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13024025)(13017025)(13015025)(13018025)(8121501046)(5005006)(13023025)(10201501046)(3002001);SRVR:AM4PR05MB1524;BCL:0;PCL:0;RULEID:;SRVR:AM4PR05MB1524; X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1524;4:rfbiOaYSyQ+q0ooOgUXXo5pTyADjfWvnrwxEr/hW/JVayXdtnhqCwrAfH/NGj05XK//xrivHm9uU1nK6/t4vWraSMqQ24yZvUZjN9QnER5CzUWcFuzNeIJ2MSVNAoR3et17oRh12WH0jxd/V0scKw7InYoch9M6MMr9ZE8xoqB0NHe9eLHepua67KhfjiTLLt7eebNGd6IyY2hLL5FUP+zfHsf32u8xwnNksHdQdtI+JcFH+HMkoBHeMJ76RmTrIJvYIeY0GOtq73PFtTnAqse1th+2mWFNelDl0zwTqe5mZHHA3hqtQ+pbFAX8gtOMyWivypETttj9/lUo7dZm5ynTx80Pg2U497LKtMfaI9QJUmbVjoC2zBC9pVxtsny7l7dJA95JE0dhGLUx4PaUQbcceybZWc2rlDWJiusJ6lkzWpFoYq7HFHpwkRd4yw8IYgxIrEOXA5zocMcpw7N3hdA== X-Forefront-PRVS: 086943A159 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;AM4PR05MB1524;23:9wNPcyFDVJIfla29sO2o5QoK8aSKXxlLF66wSafyJ?= =?us-ascii?Q?1+8hf5Jfo6DOfdajujU367cj91NlWcVb85PKww7QXciEkUCoPLAkAP0HnPnG?= =?us-ascii?Q?94nxqhxMyCbBlGcgM5w62FDxNyruCK3WR0PL2bxrDM1KMg97BL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shAqesEvkBlyhi61CuDu55cneRFpXstDZK4EbHQ6?= =?us-ascii?Q?6452A8A+2EmfGooAUY/ShVqGrkHwem2bT6PXGH9ytjFtQw6oPnBeYFEzd+aT?= =?us-ascii?Q?EJd8BCbN+Xs6xPs29jltWEqmlDSNTtSmvAqRa7WAPx7LOUlbX/Nmw=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1;AM4PR05MB1524;5:owHSzAcpm//K58PfR2ZcU/WKp8mC2TwnngOw4dvUc1YKfxBbCCR9Jxe9EXzHe/NwvQEzgCA1uuC4XmRVZDav9bqSFy+Qs99HS1s936ON+weGRT3Cw/UDRnjLpLrb/999rHmMw9GbIEiZGrsRxGMQ2Q==;24:/U0QpXMANQtlIO8pmP6mGaFdFVL46HjkRCBHCygbK2UfBtfW6oemCHYvEaqtt+E1Nyb9RTceCMe5qYTiaZ1q8C4erMJQPz1Y/4gvTvtMaZE= X-OriginatorOrg: ezchip.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2016 20:10:05.3161 (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: AM4PR05MB1524 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1997 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.1.2