Received: by 10.192.165.156 with SMTP id m28csp378873imm; Wed, 11 Apr 2018 00:06:59 -0700 (PDT) X-Google-Smtp-Source: AIpwx49kd9/6eWz9stgEwKibIFTBl+m5EEYUOyXbkR3HG7+/198tSUSqlJyiGM+6oWzbQJ0cnb3b X-Received: by 10.99.125.78 with SMTP id m14mr2576660pgn.190.1523430419659; Wed, 11 Apr 2018 00:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523430419; cv=none; d=google.com; s=arc-20160816; b=fnkAepsa8HtLOH5VxcHYA1eJ9gQ8M7JCE+M3Dh2OD5mg8hTFFvwE1mPvUmgePdmNNR m3Dfc7m5J/R4X8YVBI6ckPQY4AE9jbae4p6EiI3Md7r4u/XaXJwgDyGVDhEbUdQGpyj0 IOe8tPdvasIlLfSLTzxQngFgrIoZIR3b2XzfY/7AIRV7L87W+GxWfvziWZ/nnVkI/Lxx bIOnYvttb9xMPk9Zl7gz/uI6+jssHdwDRxA6iqFD277FQueTQL/Jr2zqubkCLzC4ux+a mL/l7uuNaSutXU5W8ric71KAqGEclvj31tdblKmR2jKTxArsj5WS8Cg0Ij08Y3yZhOC5 LJlw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=3y2iVUIvBEMNCw8psB0BnENo0owZjnjZ25ENiXYr1mM=; b=oH8knPfCxID9qLY1Lgc1KOBKEq7l8Ae4u2IOSrMijKadmPmZ/9bDo945e6xhvc+bh6 kJxzHgggmW8GJdW+UZ9bjktqQmMG5LDTJTbb613gRzphS4T0j+cABtxGVlBQSH42yfdG GaRovQSeH6g7d51w4g1riB/LUqCDm7cqI/16uFhPXzHk0TDekU4ZcXiX00MAjMHmCW01 TiUH5XKEEyNn9QKBu5r4Tb+jCUSwd180e81DUyFXN9OrhRGkTyUhlFx9BELupgUhSuko 9K1pon5zJ5HhF3gv9yQWJZwl1NIzK3Hj2kmZdykXwY2N4bOqkLVySjl+2ZGZ0Tz1Mc9Z 53Kw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h12-v6si511157plt.723.2018.04.11.00.06.22; Wed, 11 Apr 2018 00:06:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752470AbeDKHAZ (ORCPT + 99 others); Wed, 11 Apr 2018 03:00:25 -0400 Received: from mx2.suse.de ([195.135.220.15]:46217 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751983AbeDKHAX (ORCPT ); Wed, 11 Apr 2018 03:00:23 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E656BAF8B; Wed, 11 Apr 2018 07:00:21 +0000 (UTC) From: Vlastimil Babka To: Andrew Morton Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Vlastimil Babka , stable@vger.kernel.org, Joonsoo Kim , David Rientjes , Pekka Enberg , Christoph Lameter , Tejun Heo , Lai Jiangshan , John Stultz , Thomas Gleixner , Stephen Boyd Subject: [PATCH] mm, slab: reschedule cache_reap() on the same CPU Date: Wed, 11 Apr 2018 09:00:07 +0200 Message-Id: <20180411070007.32225-1-vbabka@suse.cz> X-Mailer: git-send-email 2.16.3 In-Reply-To: <20180410081531.18053-1-vbabka@suse.cz> References: <20180410081531.18053-1-vbabka@suse.cz> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org cache_reap() is initially scheduled in start_cpu_timer() via schedule_delayed_work_on(). But then the next iterations are scheduled via schedule_delayed_work(), i.e. using WORK_CPU_UNBOUND. Thus since commit ef557180447f ("workqueue: schedule WORK_CPU_UNBOUND work on wq_unbound_cpumask CPUs") there is no guarantee the future iterations will run on the originally intended cpu, although it's still preferred. I was able to demonstrate this with /sys/module/workqueue/parameters/debug_force_rr_cpu. IIUC, it may also happen due to migrating timers in nohz context. As a result, some cpu's would be calling cache_reap() more frequently and others never. This patch uses schedule_delayed_work_on() with the current cpu when scheduling the next iteration. Signed-off-by: Vlastimil Babka Fixes: ef557180447f ("workqueue: schedule WORK_CPU_UNBOUND work on wq_unbound_cpumask CPUs") CC: Cc: Joonsoo Kim Cc: David Rientjes Cc: Pekka Enberg Cc: Christoph Lameter Cc: Tejun Heo Cc: Lai Jiangshan Cc: John Stultz Cc: Thomas Gleixner Cc: Stephen Boyd --- mm/slab.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/slab.c b/mm/slab.c index 9095c3945425..a76006aae857 100644 --- a/mm/slab.c +++ b/mm/slab.c @@ -4074,7 +4074,8 @@ static void cache_reap(struct work_struct *w) next_reap_node(); out: /* Set up the next iteration */ - schedule_delayed_work(work, round_jiffies_relative(REAPTIMEOUT_AC)); + schedule_delayed_work_on(smp_processor_id(), work, + round_jiffies_relative(REAPTIMEOUT_AC)); } void get_slabinfo(struct kmem_cache *cachep, struct slabinfo *sinfo) -- 2.16.3