From patchwork Fri May 4 10:44:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 10380319 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2FB7B60353 for ; Fri, 4 May 2018 10:45:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 18D552937E for ; Fri, 4 May 2018 10:45:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BF9D29164; Fri, 4 May 2018 10:45:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3864D29164 for ; Fri, 4 May 2018 10:45:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3B62C6B0011; Fri, 4 May 2018 06:45:02 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 33DCB6B0012; Fri, 4 May 2018 06:45:02 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 205F76B0022; Fri, 4 May 2018 06:45:02 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-wr0-f199.google.com (mail-wr0-f199.google.com [209.85.128.199]) by kanga.kvack.org (Postfix) with ESMTP id B329F6B0011 for ; Fri, 4 May 2018 06:45:01 -0400 (EDT) Received: by mail-wr0-f199.google.com with SMTP id k16-v6so13875591wrh.6 for ; Fri, 04 May 2018 03:45:01 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:mime-version:content-transfer-encoding; bh=v2okcYLjDIlCvh/YkKhXo/VCN6EppuYXH3CSNK6o89s=; b=YWPvpT8mDQQfc2bg/ISQZBLPHrub2j0JO5lNVpuRiE4YdGcmt/wbrzDJqDW3MKniE6 5qoIKgYfho1Z8DNr2y+hWHvLfWTl6QWpBSQJVXH6oU8+1q2vLi7ZpBIDTM0x2yI0XeJN Co0mAswa/Gx0aoQAaiL0Wc2RSdVxlfbCzP+pXYXksfL8Mf3M9JJ664rEYw/XAkeBBgQH sojW7zeY+Mi9Ftbt340CQlSc5Iq1J76Yg8EVEbIHaigw9yUwpNFDU8o7d/VhDotNaxoD athZGSpiLJDw5mWXQ3PUklq7wcXUmD8L7hD3XYsXcW2Y1mD4Wj7Ps0SNl4K5nUcQH/YH HnLA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bigeasy@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de X-Gm-Message-State: ALQs6tDd0mau/JCHntbo15lSHwsthVKPpwjPb3FHWGf1gQL+1gn+hWnn eb1I0lro46CHuGGAdMDlqFjzDLXFVU5VCg+h7eR2D7av8yhOikTLSKJLDVaHbt8ExPYTiCIucf1 GHXPgR+RsoMhuv/9fQNe7tQ6SChBImOivE1mxkaYBjKU68mrmS2NPZmOL+R23g+sNBg== X-Received: by 10.28.23.15 with SMTP id 15mr17352039wmx.90.1525430701181; Fri, 04 May 2018 03:45:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrECRX+kXwW5XZsYcYm8VS0RvQvyO9bGZyrDql98ODMxdfrSjJ2ouUPbFOhT+a20KpRlhu9 X-Received: by 10.28.23.15 with SMTP id 15mr17351988wmx.90.1525430699798; Fri, 04 May 2018 03:44:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525430699; cv=none; d=google.com; s=arc-20160816; b=CNgDJfpeC5nu946xemyW7mxrxYVzQEWi6QgCypOs1oZc92oy39t21ZLaRNcYD4KWIK mI9yHxh/P1zTxnenmkpTjlU4+W00p+qhe9dUdd5k6+i0Iu3tZIpchVSlWiVtuA5khG52 sCLWaawhBZ9xPXnX1St3A+dqWq/aaH4KSPBxpzdpqn4LLPFuy8BCYkq/kau4IMMi8W6/ QP9j00mHvIC5RsnQedBwIxUM2MZoy9Yb1pXB3WZ+lcQYMxFbdW7sQowxkFbeeMDrooO2 gwnF2X6SV8vFDG6+sOrNeGX9bcSoX8EGIZZqaMKEN5a4oKWlRmNhieu5xVUXp+6i9srt Magw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:arc-authentication-results; bh=v2okcYLjDIlCvh/YkKhXo/VCN6EppuYXH3CSNK6o89s=; b=ol/b487XptJm0LaVU+bmrdLUr9AyUNwvBQJ7nE+H/0/RAikEeFbSf7LRNXN2PkDcYz oUrKzacH1FYlTsG2OinyT5MPeNrggpMmoqjpTr5kYqL3Lj3D8O3JfowwEIwDT+B8hU+g dnKpOkfBmsKHJTESxUNHZTEpo4QD8iUnkiUk4XYJp1BRXGqEr2J/oiAFgt8CVNkVUdPn tJvff0Jv0nTEIWr7/BElcvWc7tfB+R10Wo/fI5GurDGBtO7wPRl65bzkpOEPSqd3mK0p Q0PDxgcqiJu/mc1e6LTdDjG1ryXDRvz697nGrF/YKuvbyDRrFCZW631x9UqsoppOMzQD W0Zw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of bigeasy@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de Received: from Galois.linutronix.de (Galois.linutronix.de. [2a01:7a0:2:106d:700::1]) by mx.google.com with ESMTPS id g130-v6si1167550wme.55.2018.05.04.03.44.59 for (version=TLS1_2 cipher=AES128-SHA bits=128/128); Fri, 04 May 2018 03:44:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of bigeasy@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) client-ip=2a01:7a0:2:106d:700::1; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of bigeasy@linutronix.de designates 2a01:7a0:2:106d:700::1 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de Received: from localhost ([127.0.0.1] helo=bazinga.breakpoint.cc) by Galois.linutronix.de with esmtp (Exim 4.80) (envelope-from ) id 1fEYCv-0000xz-8o; Fri, 04 May 2018 12:44:57 +0200 From: Sebastian Andrzej Siewior To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: tglx@linutronix.de, Vlastimil Babka , Sebastian Andrzej Siewior , "Steven J . Hill" , Tejun Heo , Andrew Morton Subject: [PATCH REPOST] Revert mm/vmstat.c: fix vmstat_update() preemption BUG Date: Fri, 4 May 2018 12:44:51 +0200 Message-Id: <20180504104451.20278-1-bigeasy@linutronix.de> X-Mailer: git-send-email 2.17.0 MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP This patch reverts commit c7f26ccfb2c3 ("mm/vmstat.c: fix vmstat_update() preemption BUG"). Steven saw a "using smp_processor_id() in preemptible" message and added a preempt_disable() section around it to keep it quiet. This is not the right thing to do it does not fix the real problem. vmstat_update() is invoked by a kworker on a specific CPU. This worker it bound to this CPU. The name of the worker was "kworker/1:1" so it should have been a worker which was bound to CPU1. A worker which can run on any CPU would have a `u' before the first digit. smp_processor_id() can be used in a preempt-enabled region as long as the task is bound to a single CPU which is the case here. If it could run on an arbitrary CPU then this is the problem we have an should seek to resolve. Not only this smp_processor_id() must not be migrated to another CPU but also refresh_cpu_vm_stats() which might access wrong per-CPU variables. Not to mention that other code relies on the fact that such a worker runs on one specific CPU only. Therefore I revert that commit and we should look instead what broke the affinity mask of the kworker. Cc: Steven J. Hill Cc: Tejun Heo Cc: Andrew Morton Signed-off-by: Sebastian Andrzej Siewior Acked-by: Vlastimil Babka --- mm/vmstat.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/vmstat.c b/mm/vmstat.c index 33581be705f0..40b2db6db6b1 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1839,11 +1839,9 @@ static void vmstat_update(struct work_struct *w) * to occur in the future. Keep on running the * update worker thread. */ - preempt_disable(); queue_delayed_work_on(smp_processor_id(), mm_percpu_wq, this_cpu_ptr(&vmstat_work), round_jiffies_relative(sysctl_stat_interval)); - preempt_enable(); } }