From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-189.mta1.migadu.com (out-189.mta1.migadu.com [95.215.58.189]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A72D93C09F1 for ; Wed, 8 Jul 2026 06:00:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=95.215.58.189 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783490402; cv=none; b=aSaJR8HZ9Qm+ilyt1wXCJN+6QP2+enzHkhHFKsRaoytaFSrpep1SvWpWPsS9ibKUwdto1RH7Ho/Pp5lfdsRHgyLqY6vWa86GJweG4y4zkcG6RCBgM+J/mrc0lDtgXVwZYnlrfk5K15vRufTvpFkjHGFZAZeyByvOVQ6LOFA0SC8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783490402; c=relaxed/simple; bh=zcK1n7OwclMe4GYcIX91Q9CnfEPUaXMiEZ5ig4V0le8=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=X1qoGleKA+qT9PoBSxG0o9eRVS1Pp1VHR9H/G7ClUi9UA7fgnrlyD2O8+XJuuyfDLAlPqRe4Y16RGqk0LH3sJaB2oEClE6uBedmvkO9GdpW1l30D6dXl6oKISAtAHU0f9HPMaxRqQ86TWeo71FLrHmXGOLtSNdowS6TP3qlmLeE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=qUwbse1b; arc=none smtp.client-ip=95.215.58.189 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="qUwbse1b" Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1783490388; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=eYKa8VorN82UBu29vJvoz8hsnRtQvA3Z05HbUIKmT8g=; b=qUwbse1bOLEJIE3aV3YI11wZcGysrZgXQhZUeXl+0cexgm141/wxFNxxrn4eE8cIVfw9T7 EpmQV1KBae6jAuLOnr85mP60PrnT1tvA0IftUdfWBp5/6ooeDk5fK/Pc1uNw3gqxsg5Tlw +VnrPXhYrBoiJ0S1Toa2bAXmXZ8ts4k= Date: Wed, 8 Jul 2026 13:59:15 +0800 Precedence: bulk X-Mailing-List: linux-block@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Subject: Re: [PATCH] blk-cgroup: clear blkg->pd[] with WRITE_ONCE() in blkcg_deactivate_policy() To: Tao Cui , Tejun Heo , Josef Bacik , Jens Axboe Cc: Yu Kuai , cgroups@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, Guopeng Zhang References: <20260707125814.1978139-1-guopeng.zhang@linux.dev> <841e91db-a51e-4df5-8cfc-e3762a2fecf1@linux.dev> Content-Language: en-US X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Guopeng Zhang In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT 在 2026/7/8 13:29, Tao Cui 写道: > FYI, this WRITE_ONCE() change is also in Yu Kuai's in-flight series that > factors the pd teardown loop into a helper: > > https://lore.kernel.org/all/20260625025739.2459651-5-yukuai@kernel.org/ > > That series isn't merged yet (v3, 2026-06-25), so this minimal Fixes > patch is still useful in the meantime -- just flagging the overlap. > hello, Thanks for the review, and thanks for pointing out the overlap. If Yu's series gets merged first, this patch can simply be dropped. Thanks, Guopeng > 在 2026/7/8 13:10, Tao Cui 写道: >> >> >> 在 2026/7/7 20:58, Guopeng Zhang 写道: >>> From: Guopeng Zhang >>> >>> blkcg_activate_policy() installs blkg->pd[] entries with WRITE_ONCE() >>> and also uses WRITE_ONCE() when clearing them on its error path. >>> blkg_to_pd() is used by RCU readers and reads the same array with >>> READ_ONCE(). >>> >>> blkcg_deactivate_policy() clears the entry with a plain store. Use >>> WRITE_ONCE() there as well. >>> >>> Fixes: 56cc24f59c14 ("blk-cgroup: don't nest queue_lock under rcu in blkcg_print_blkgs()") >>> Signed-off-by: Guopeng Zhang >>> --- >>> block/blk-cgroup.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/block/blk-cgroup.c b/block/blk-cgroup.c >>> index d2a1f5903f24..a1dd69f99f5c 100644 >>> --- a/block/blk-cgroup.c >>> +++ b/block/blk-cgroup.c >>> @@ -1691,7 +1691,7 @@ void blkcg_deactivate_policy(struct gendisk *disk, >>> if (blkg->pd[pol->plid]->online && pol->pd_offline_fn) >>> pol->pd_offline_fn(blkg->pd[pol->plid]); >>> pol->pd_free_fn(blkg->pd[pol->plid]); >>> - blkg->pd[pol->plid] = NULL; >>> + WRITE_ONCE(blkg->pd[pol->plid], NULL); >>> } >>> spin_unlock(&blkcg->lock); >>> } >> >> Reviewed-by: Tao Cui >> >