Received: by 10.192.165.156 with SMTP id m28csp1088859imm; Wed, 11 Apr 2018 12:11:38 -0700 (PDT) X-Google-Smtp-Source: AIpwx49d+7EVR1GfZCakfZJ2Ig5QBQzA2ZHtmQa02rp5bEiHVZvEXW/Lpewl+fQKH2wz7henn0Yf X-Received: by 10.99.36.7 with SMTP id k7mr4358115pgk.63.1523473898334; Wed, 11 Apr 2018 12:11:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523473898; cv=none; d=google.com; s=arc-20160816; b=1G2Igj8xH1ra6RDIVXg/5gLAY0oxDV3QHXfyiPGRAuCjZjagD4yZ/i1hdepij6UHU6 JGGf/M0Lz0mRblrE5JkxQGL/QuOtNDti5DKXoCDWCPjuNp4S67/VM8PrXgxDkCU4E0TP xqFWlsX47JOFL5xe7+QUurNb4k2EwtyBNk50STHUiieSW2SmaJMVzLb7gLUqjgB4C3F2 gEWR3nqa2sDpdrcUwVbxwjA0fP3xhsQ9v+50J7phPdI+wmLap2dLhXrimn6fl97GA1qU +sB7f4rVVDViRVtkMlvDVuUTUb/5ckeWeEvLeCdFJwxRlbHxYZNJq7qPcDHtMEK5exfL IfMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=GdjGPF5HoFiVQlMEYx7OjDxoaiK3QcltsrgN0tctA8w=; b=gCo2Pb+OVjrgAYSZLnMjYDJXdejUIKz7rByogNzf2hwfYbtPTYoAY9Pndm7Gez54hN tLFn316JVmDKnQ6G9G32Peu16AdexWSgZZ326lqt43WYVQu37R7ckQBuKuJXevj7Xh0s 0j06NzoqDIsKbmfTQvyEiE9QYzk5o/9zBK7rzSM4o1eUUWYlmmD0au4lbDnsryxYuP94 7sFyDQHvq+6GemMzPdzIByVN+s5Fe/z9QqHgj/rnhr/0/6sX6lMzsEw9jdsyuaRyFpMH 58S6BcRmF3pfhPeMOrGGAGIx9d4ibNrFKuuPBRLtBVTX249He04asEMse0xwoKFvYTAp ZgHQ== 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 i63si1337710pfk.159.2018.04.11.12.11.01; Wed, 11 Apr 2018 12:11:38 -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 S935402AbeDKTHf (ORCPT + 99 others); Wed, 11 Apr 2018 15:07:35 -0400 Received: from Galois.linutronix.de ([146.0.238.70]:58747 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754938AbeDKTHe (ORCPT ); Wed, 11 Apr 2018 15:07:34 -0400 Received: from bigeasy by Galois.linutronix.de with local (Exim 4.80) (envelope-from ) id 1f6L5e-00014e-2S; Wed, 11 Apr 2018 21:07:30 +0200 Date: Wed, 11 Apr 2018 21:07:30 +0200 From: Sebastian Andrzej Siewior To: Tejun Heo Cc: Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org, tglx@linutronix.de, "Steven J . Hill" , Andrew Morton , Christoph Lameter Subject: Re: [PATCH] Revert mm/vmstat.c: fix vmstat_update() preemption BUG Message-ID: <20180411190729.7sbmbsxtkcng7ddx@linutronix.de> References: <20180411095757.28585-1-bigeasy@linutronix.de> <20180411140913.GE793541@devbig577.frc2.facebook.com> <20180411144221.o3v73v536tpnc6n3@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180411144221.o3v73v536tpnc6n3@linutronix.de> User-Agent: NeoMutt/20180323 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018-04-11 16:42:21 [+0200], To Tejun Heo wrote: > > > So is this perhaps related to the cpu hotplug that [1] mentions? e.g. is > > > the cpu being hotplugged cpu 1, the worker started too early before > > > stuff can be scheduled on the CPU, so it has to run on different than > > > designated CPU? > > > > > > [1] https://marc.info/?l=linux-mm&m=152088260625433&w=2 > > > > The report says that it happens when hotplug is attempted. Per-cpu > > doesn't pin the cpu alive, so if the cpu goes down while a work item > > is in flight or a work item is queued while a cpu is offline it'll end > > up executing on some other cpu. So, if a piece of code doesn't want > > that happening, it gotta interlock itself - ie. start queueing when > > the cpu comes online and flush and prevent further queueing when its > > cpu goes down. > > I missed that cpuhotplug part while reading it. So in that case, let me > add a CPU-hotplug notifier which cancels that work. After all it is not > need once the CPU is gone. This already happens: - vmstat_shepherd() does get_online_cpus() and within this block it does queue_delayed_work_on(). So this has to wait until cpuhotplug completed before it can schedule something and then it won't schedule anything on the "off" CPU. - The work item itself (vmstat_update()) schedules itself (conditionally) again. - vmstat_cpu_down_prep() is the down event and does cancel_delayed_work_sync(). So it waits for the work-item to complete and cancels it. This looks all good to me. > > Thanks. Sebastian