From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pa0-f51.google.com (mail-pa0-f51.google.com [209.85.220.51]) by kanga.kvack.org (Postfix) with ESMTP id 323F26B0005 for ; Fri, 11 Mar 2016 17:11:10 -0500 (EST) Received: by mail-pa0-f51.google.com with SMTP id td3so82476465pab.2 for ; Fri, 11 Mar 2016 14:11:10 -0800 (PST) Received: from EUR01-HE1-obe.outbound.protection.outlook.com (mail-he1eur01on0068.outbound.protection.outlook.com. [104.47.0.68]) by mx.google.com with ESMTPS id a22si12076778pfj.116.2016.03.11.14.11.08 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 11 Mar 2016 14:11:09 -0800 (PST) From: Chris Metcalf Subject: [PATCH v11 03/13] lru_add_drain_all: factor out lru_add_drain_needed Date: Fri, 11 Mar 2016 17:10:13 -0500 Message-ID: <1457734223-26209-4-git-send-email-cmetcalf@mellanox.com> In-Reply-To: <1457734223-26209-1-git-send-email-cmetcalf@mellanox.com> References: <1457734223-26209-1-git-send-email-cmetcalf@mellanox.com> MIME-Version: 1.0 Content-Type: text/plain Sender: owner-linux-mm@kvack.org List-ID: 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 , linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Chris Metcalf 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 -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org