Received: by 10.192.165.148 with SMTP id m20csp2546063imm; Sun, 22 Apr 2018 09:16:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx49bUZkqe6rRQ8EpL9owoKNnXjPy+8tTYkgzT97o+pBLK7dGWvDdTONZXr6gjoz+8Q1QuM+/ X-Received: by 10.101.91.7 with SMTP id y7mr14412554pgq.396.1524413801121; Sun, 22 Apr 2018 09:16:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524413801; cv=none; d=google.com; s=arc-20160816; b=y5t5H+TJrIHo7LM+edWzJpiOQla7PuUQJ52zZfs36yHSS9peoTBCObEV0vEkZw534M yROKIEYRqjuxY4OwjkgQoZ3AFzwjCofjk+3/Fo6zZxHfIVWxM81a/3wDtRHkUNWFaRgz hz8OHUqZsDruM9p6Ymt5DKGgk8SXv+ok3Fnd3w73VUwoqKO8DXkoNr8wJ7MDZ+0evkUj h/PS7nQLcEuu2V2k9rQteHfhlRQL9Z37pk47x3H2ztkEyERoEQVzR4Q8XXArTyHs6441 sUb9fPdRJepDMagTJrduh29QIfhNH4LXYjOv+9+k4bn2Ir9bypJGzfI4otjQ9e+IfCBt z6EQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bU4tYXSm6u8Ne9RauScgllt9NDI81SzM7+iL1iHZq3Q=; b=Boy55JJ2EVlI0LjzMfqhJ4wVwMAsMDhupC/7J/w8ivwaXSuRQu1F90FGKKQEyAqm53 Me0aGdDOB3ZX5AZGkFskTV6WwAUTkIRM0XcH7Rz5TSicvO7nsO6HteRrocGK9WGcGnQc oOlpMP5erRN+fdoNJ6gIPS/uWJBqFYrtwsIIRid+r6SkcSLzAViKFGt52Rm55pUK4OBE NTOihASS/3+qHBE0cJy9DRXBDtyGyZwzC9nNbjNvv4xoIZV0IskbZys8r7jnni/UpWoq 4DdpqvIcXc2sWV8Hs4VE2tasaTX0nGmvIlIIWHgmbnCiLTJ7yzlUftEIJ0Nya3p/nSnA V19Q== 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 a61-v6si10102572pla.271.2018.04.22.09.16.26; Sun, 22 Apr 2018 09:16:41 -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 S1753426AbeDVNzE (ORCPT + 99 others); Sun, 22 Apr 2018 09:55:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:44382 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751787AbeDVNy7 (ORCPT ); Sun, 22 Apr 2018 09:54:59 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3E0EB8FF; Sun, 22 Apr 2018 13:54:58 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vlastimil Babka , Pekka Enberg , Christoph Lameter , Joonsoo Kim , David Rientjes , Tejun Heo , Lai Jiangshan , John Stultz , Thomas Gleixner , Stephen Boyd , Andrew Morton , Linus Torvalds Subject: [PATCH 4.16 016/196] mm, slab: reschedule cache_reap() on the same CPU Date: Sun, 22 Apr 2018 15:50:36 +0200 Message-Id: <20180422135104.957692051@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180422135104.278511750@linuxfoundation.org> References: <20180422135104.278511750@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Vlastimil Babka commit a9f2a846f0503e7d729f552e3ccfe2279010fe94 upstream. 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. Link: http://lkml.kernel.org/r/20180411070007.32225-1-vbabka@suse.cz Fixes: ef557180447f ("workqueue: schedule WORK_CPU_UNBOUND work on wq_unbound_cpumask CPUs") Signed-off-by: Vlastimil Babka Acked-by: Pekka Enberg Acked-by: Christoph Lameter Cc: Joonsoo Kim Cc: David Rientjes Cc: Tejun Heo Cc: Lai Jiangshan Cc: John Stultz Cc: Thomas Gleixner Cc: Stephen Boyd Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- mm/slab.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/mm/slab.c +++ b/mm/slab.c @@ -4074,7 +4074,8 @@ next: 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)