From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from va-2-20.ptr.blmpb.com (va-2-20.ptr.blmpb.com [209.127.231.20]) (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 30F213CAA4F for ; Sun, 6 Sep 2026 11:41:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.127.231.20 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788694901; cv=none; b=g6JGpcy8d1Ufgu+R7ixrUXl/Og+Ro/AvZTiPQTG0qOte36YqISqIk11+p7Brm5xvF3MKAHobs89LyIx5ijVobZ+NtVYqeS6PskohSL9dsp0aBNuBd9rlFhw1whyLu+XsRy3Uw3+Jrx7vOQXXDQp7FoVfKN55YQPqCCvBS4xMgjU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788694901; c=relaxed/simple; bh=Txjb4A2ru0WHH8ExTeA1+aRZilQ6U0tRJ24xs4Setuk=; h=Subject:Mime-Version:References:From:Date:Message-Id:Content-Type: To:Cc:In-Reply-To; b=dTE++zJUSblYbvxtZOMCWNwCvcLsPINJ6GRKdqWvUx6jkXHSaEgCrmQWi8mcMukK5cg98NFSy9U/m46u7H+1Q8q+Pdu+TKwjNHHq1zv/NOrjnTvzZCiEG/SM8ivZ4b+O0IinB00IKZFJXnFZI5MS9jyLPXgF42EBJOnnH5Za9Qk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fygo.io; spf=pass smtp.mailfrom=fygo.io; dkim=pass (2048-bit key) header.d=fygo-io.20200929.dkim.larksuite.com header.i=@fygo-io.20200929.dkim.larksuite.com header.b=gsMGNOoB; arc=none smtp.client-ip=209.127.231.20 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=fygo.io Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fygo.io Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fygo-io.20200929.dkim.larksuite.com header.i=@fygo-io.20200929.dkim.larksuite.com header.b="gsMGNOoB" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=s1; d=fygo-io.20200929.dkim.larksuite.com; t=1788694893; h=from:subject:mime-version:from:date:message-id:subject:to:cc: reply-to:content-type:mime-version:in-reply-to:message-id; bh=Txjb4A2ru0WHH8ExTeA1+aRZilQ6U0tRJ24xs4Setuk=; b=gsMGNOoBKWnuzNae+zqKdZqMscRCD1AiEZYEY6htIlRk6+gNoKGaQmKYsKYNBjNXUm1bg6 xGaAOEqOARkImszoU6UA/pFzyCd7LSfk32qvYJElb/bqw7GJgVgWGZ/PG3teeTMVKxDjz2 0+sL2e/vQDFiT2KHBN7ctjFgp5CUS+dexxkSZWJwgupilHVZmfc9Qu+tcyc4J2ZBybJEYE 3O7lCgnI+/VOUxbbNaHQn/Cwet4hIu6rLmTVNizTAhAmTzubMJhfIq3DvQpPSPhj27EBwQ 19siYfKDSN/tMAK0s7/7xhbUyXGLHqWKoqogA1tdzyeiqm81vko7cmrmvzJ4AQ== Subject: Re: [PATCH 3/3] blk-cgroup: move async bio punt state to blkcg Precedence: bulk X-Mailing-List: virtualization@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 X-Lms-Return-Path: References: <20260823133045.970199-1-yukuai@kernel.org> <20260823133045.970199-4-yukuai@kernel.org> Reply-To: yukuai@fygo.io From: "yu kuai" Content-Transfer-Encoding: quoted-printable Received: from [192.168.1.104] ([39.182.0.178]) by smtp.larksuite.com with ESMTPS; Sun, 06 Sep 2026 11:41:32 +0000 Date: Sun, 6 Sep 2026 19:41:24 +0800 Message-Id: <4706f5fa-3a09-4c48-aa4b-c56521166618@fygo.io> X-Original-From: yu kuai Content-Type: text/plain; charset=UTF-8 User-Agent: Mozilla Thunderbird To: "Nilay Shroff" , "Yu Kuai" , "Jens Axboe" , "Tejun Heo" , "Josef Bacik" , "Johannes Weiner" , =?utf-8?q?Michal_Koutn=C3=BD?= , "yu kuai" Cc: "Christoph Hellwig" , "Tao Cui" , "Jan Kara" , "Jonathan Corbet" , "Shuah Khan" , "Coly Li" , "Kent Overstreet" , "Alasdair Kergon" , "Mike Snitzer" , "Mikulas Patocka" , "Benjamin Marzinski" , "Song Liu" , "Li Nan" , "Xiao Ni" , "Pankaj Gupta" , "Dan Williams" , "Vishal Verma" , "Dave Jiang" , "Alison Schofield" , "Ira Weiny" , "Andreas Gruenbacher" , "Matthew Wilcox" , "Andrew Morton" , "Chris Li" , "Kairui Song" , "Kemeng Shi" , "Nhat Pham" , "Baoquan He" , "Barry Song" , "Youngjun Park" , , , , , , , , , , , , In-Reply-To: Hi, =E5=9C=A8 2026/9/6 19:01, Nilay Shroff =E5=86=99=E9=81=93: > On 8/23/26 7:00 PM, Yu Kuai wrote: >> @@ -111,10 +104,15 @@ struct blkcg { >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 /* >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 * List of updated percpu blkg_iosta= t_set's since the last flush. >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 */ >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct llist_head __percpu=C2=A0=C2=A0=C2= =A0 *lhead; >> =C2=A0 +#ifdef CONFIG_BLK_CGROUP_PUNT_BIO >> +=C2=A0=C2=A0=C2=A0 spinlock_t=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 async_bio_lock; /* protects async_bios */ >> +=C2=A0=C2=A0=C2=A0 struct bio_list=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 async_bios; >> +=C2=A0=C2=A0=C2=A0 struct work_struct=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0 async_bio_work; >> +#endif >> =C2=A0 #ifdef CONFIG_BLK_CGROUP_FC_APPID >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 char=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 fc_app_id[FC_APPID_LEN]= ; >> =C2=A0 #endif >> =C2=A0 #ifdef CONFIG_CGROUP_WRITEBACK >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 struct list_head=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 cgwb_list; > > As I mentioned, Clang context annotations are now officially supported > in the block layer. Since you're touching this code, I suggest annotating > async_bios with __guarded_by(&async_bio_lock) as well. > > This would allow the Clang thread-safety analyzer to verify that every > access to async_bios is properly protected by async_bio_lock. Sounds reasonable, will do this in the next version. > > Thanks, > --Nilay --=20 Thanks, Kuai