Received: by 2002:a05:7412:b995:b0:f9:9502:5bb8 with SMTP id it21csp5289394rdb; Sat, 30 Dec 2023 14:39:32 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmDmKmco5bkDN/OK7aAVPfCv6n8IsPVfj23rMSvNN/EeH1UZ3b34CTJShk0TNmSP7DAm6/ X-Received: by 2002:a05:6e02:12ce:b0:35f:f6e9:b4e6 with SMTP id i14-20020a056e0212ce00b0035ff6e9b4e6mr14562599ilm.12.1703975972486; Sat, 30 Dec 2023 14:39:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1703975972; cv=none; d=google.com; s=arc-20160816; b=y2IAzCzFlCTTVP/pwQSUkV6CT3vCsg6XoibPEUe8loZtr203RnlvVEUbcsnid37FWv XuG2EL1TRP1+r0IBTIjGC9G68GnAHrLCZLAj8B1OcgLxxkQz+AtrSygKJmN7RSqBdnl0 t+7isYRlBWK98dXeemfflm6Q/KAfE7GSxKvHUzaaWJDAZRtcysNzY/yfFY6LpjZtQXlC 9jSnWGMJ2/RD1cD2S2jN2s5/YrobSrcrLJtfxNdojcqmgYxPXuxkpXlk/FEAjnt/coyT Eq0o11HdoC4Ig369uEtqiNAt/FeRH3PmlVl6T5c/g6eK0fZRGejyN4SXD6KbDogW9y33 HA7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=s95fd8CWPyRAX6w7x1MUkDahCkeW5Ikcu9kmhfogHKg=; fh=3RDleo3pYz9uaErVNZ77HTTtdHcA7axEDsuy50p9sPE=; b=ePlOJnDkQ2d/yQLl48MVnHKTCKE3a7sf3PaJhdgV1QtJ0A6b8ugQHrIrpqjz+xmkhr 2eLpKaWBT2Lrz4uc1s4yAUcnKBBXUSaeBctUvF9b4kIMWVCOIFCykvFH3g06w7gDyoau /UMKoj17AEWUSOha7+wK/UWPoBFn7MkRmYS8x/oSA+wcI1Ka86iONg1y1XYfhr+0q2BB L89Qn5FQcyJWfdz/UB06Rr5k/qDmJgK0QUBh7i00MlYRvHUOWZxWZI5k/Cdsi3n6S5GZ ypOL6Qn+V+BBs6wsi6+D+LyXPtvnCgj+0vobkdYNXmZSCNw4u0oGocLDBx49GagqzJIa CfuA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-13601-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id k11-20020a170902c40b00b001d0187da0a0si1575148plk.292.2023.12.30.14.39.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 14:39:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-13601-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-13601-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-13601-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 27782283CEF for ; Sat, 30 Dec 2023 22:39:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 216AEF9CF; Sat, 30 Dec 2023 22:39:26 +0000 (UTC) X-Original-To: linux-kernel@vger.kernel.org Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3D7D3E54D for ; Sat, 30 Dec 2023 22:39:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-2045bedb806so5269913fac.3 for ; Sat, 30 Dec 2023 14:39:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703975963; x=1704580763; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=s95fd8CWPyRAX6w7x1MUkDahCkeW5Ikcu9kmhfogHKg=; b=IZO5FbBJF6JEN6sg7RTXo2IgRXfsgX97F7GNdr19ajqS/MGMuqXq8K/37+CyZj+2JF no47oiseeMZPyI7PoHw43Syz1Eeg9/Z5mKDYy1dQnGZkMBZBD7ocFXXPR5YnwePcC9Oi g8+uDqFJVFGYMMeWYg2l4PP5oU/VnbGeDHlg0jJjUHCrNvULcd46iOfCyqJuXLjGlk5X i2+6H0ZqYOTIh5LkXdsnmzsMTcHfYlmqQWllgrGTacRuEkLzf4HqbYttm2O+OUvT7CHU J5YuPPU1xd3Ibrke884u70MHb3vYcimsxKneFJ+9kf0YbhbCejHGYJWckQZY2eqQv+9I GqAg== X-Gm-Message-State: AOJu0YxiIjx2o2oJAv2PMKhr8fXh5dDQKemequAJwBS8pb49R93r2XYh /WZhaQy/+M5lXUCMOWtmVGQ= X-Received: by 2002:a05:6870:65a4:b0:204:805:54ef with SMTP id fp36-20020a05687065a400b00204080554efmr17861120oab.86.1703975963073; Sat, 30 Dec 2023 14:39:23 -0800 (PST) Received: from snowbird ([136.25.84.107]) by smtp.gmail.com with ESMTPSA id l16-20020a656810000000b005cdfa6f5aeesm12361472pgt.94.2023.12.30.14.39.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 30 Dec 2023 14:39:22 -0800 (PST) Date: Sat, 30 Dec 2023 14:39:20 -0800 From: Dennis Zhou To: Thomas Gleixner Cc: LKML , Peter Zijlstra , Valentin Schneider , Tejun Heo , Christoph Lameter , Dave Chinner , Yury Norov , Andy Shevchenko , Rasmus Villemoes , Ye Bin , linux-mm@kvack.org Subject: Re: [patch 0/3] lib/percpu_counter, cpu/hotplug: Cure the cpu_dying_mask woes Message-ID: References: <20230414162755.281993820@linutronix.de> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230414162755.281993820@linutronix.de> Hello, On Fri, Apr 14, 2023 at 06:30:42PM +0200, Thomas Gleixner wrote: > Hi! > > The cpu_dying_mask is not only undocumented but also to some extent a > misnomer. It's purpose is to capture the last direction of a cpu_up() or > cpu_down() operation taking eventual rollback operations into account. > > cpu_dying mask is not really useful for general consumption. The > cpu_dying_mask bits are sticky even after cpu_up() or cpu_down() completes. > > A recent fix to plug a race in the per CPU counter code picked > cpu_dying_mask to cure it. Unfortunately this does not work as the author > probably expected and the behaviour of cpu_dying_mask is not easy to change > without breaking the only other and initial user, the scheduler. > > This series addresses this by: > > 1) Reworking the per CPU counter hotplug mechanism so the race is fully > plugged without using cpu_dying_mask > > 2) Replacing the cpu_dying_mask logic with hotplug core internal state > which is exposed to the scheduler with a properly documented > function. > > The series is also available from git: > > git://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git smp/dying_mask > > Thanks > > tglx > --- > include/linux/cpuhotplug.h | 2 - > include/linux/cpumask.h | 21 ---------------- > kernel/cpu.c | 45 +++++++++++++++++++++++++++++------ > kernel/sched/core.c | 4 +-- > kernel/smpboot.h | 2 + > lib/percpu_counter.c | 57 +++++++++++++++++++-------------------------- > 6 files changed, 67 insertions(+), 64 deletions(-) This has been on my mind and regretfully it's been a busy year for me. I know the merge window is around the corner, but I rebased this series onto percpu#for-6.8 [1]. I had to massage percpu_counter slightly due to some changes but other than that it largely is intact. I need to do a little bit of a more thorough pass and re-send it out, but I think it remains correct to merge. I can then pull it, give it a few days to soak in for-next and then send it to Linus either in a follow up PR or in the 2nd week of the merge window. Thomas, how does this sound to you? [1] https://git.kernel.org/pub/scm/linux/kernel/git/dennis/percpu.git/log/?h=percpu-hotplug Thanks, Dennis