From nobody Mon Sep 28 06:35:54 2026 Received: from canpmsgout11.his.huawei.com (canpmsgout11.his.huawei.com [113.46.200.226]) (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 DADDE3DEACE; Tue, 25 Aug 2026 09:53:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.226 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651633; cv=none; b=iuXsU+5bdonXDPPyTflo/+AuCHbgEUJrw4xjh8GSSSZfx/LdJlL1FDbjRva+Th0eacKWio7bwzOh9MlSzEL+yczC/v3ZobJ2WIjut1iLlf3zlBNHTKFgijM+bnxqHvYbuN78DFl7Ikp6UhN07EaeGbOB0ZsFvbg7qFjpa4x8rKQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651633; c=relaxed/simple; bh=HJdsCfuTtgmJ6PKzFdH/Ql52/qu8azKPMmn8T3cfFTk=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=pHqkuMKmGgispobLFjl9AQilidxT8JxI89fSDFkMvVNXMsLahLQIe3X7mvIXAFUwOc8Cq1hgtqfntz9bnxQHiQ2nGID5bhO1+4wurIvAcC39YzjfGhEgTnUlX+b2fKhIh9Lb7fw7p9ng4twN4PbmW1dj2fCDI/B1L2QAnNMbYFk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=sPInjYYs; arc=none smtp.client-ip=113.46.200.226 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="sPInjYYs" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=GUcokWdXQpThxiBAOIvnrP9/uDHhISaOf9TGAkhrHoo=; b=sPInjYYsXpWPlcSR4ME70cbHDD2P9opcLcsxc/8waXz8hX+c849a/0avJT0EzLUdl8A1E7Lf9 lhCiXdLpuMSpQuW38UUpzcF7YJGPYKPVEj1nKS6B6cmFDHab0Ag3Z9amI/Lq4goXJ1o1ZxVkkNW ZUx95EK94yHIQsP3leuZYZA= Received: from mail.maildlp.com (unknown [172.19.162.92]) by canpmsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4hTjWL1zBXzKm5m; Tue, 25 Aug 2026 17:42:54 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id EE88D40565; Tue, 25 Aug 2026 17:53:42 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Aug 2026 17:53:40 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH 01/11] user_namespace: Use acquire/release for nr_extents synchronization Date: Tue, 25 Aug 2026 17:54:12 +0800 Message-ID: <20260825095422.3166067-2-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825095422.3166067-1-ruanjinjie@huawei.com> References: <20260825095422.3166067-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" Replace smp_wmb()/smp_rmb() with smp_store_release()/smp_load_acquire() when publishing and consuming `nr_extents`. This expresses the publish/subscribe pattern more clearly and allows architectures with native acquire/release instructions (e.g. arm64's STLR/LDAR) to avoid the cost of full one-way barriers (DMB ISHST/ISHLD). No functional change intended. Assisted-by: DeepSeek:DeepSeek-V3 Signed-off-by: Jinjie Ruan --- kernel/user_namespace.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index 0bed462e9b2a..576b667a8813 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c @@ -317,9 +317,9 @@ map_id_range_down_base(unsigned extents, struct uid_gid= _map *map, u32 id, u32 co =20 static u32 map_id_range_down(struct uid_gid_map *map, u32 id, u32 count) { + /* Pairs with smp_store_release() in map_write(). */ + unsigned int extents =3D smp_load_acquire(&map->nr_extents); struct uid_gid_extent *extent; - unsigned extents =3D map->nr_extents; - smp_rmb(); =20 if (extents <=3D UID_GID_MAP_MAX_BASE_EXTENTS) extent =3D map_id_range_down_base(extents, map, id, count); @@ -383,9 +383,9 @@ map_id_range_up_max(unsigned extents, struct uid_gid_ma= p *map, u32 id, u32 count =20 u32 map_id_range_up(struct uid_gid_map *map, u32 id, u32 count) { + /* Pairs with smp_store_release() in map_write(). */ + unsigned int extents =3D smp_load_acquire(&map->nr_extents); struct uid_gid_extent *extent; - unsigned extents =3D map->nr_extents; - smp_rmb(); =20 if (extents <=3D UID_GID_MAP_MAX_BASE_EXTENTS) extent =3D map_id_range_up_base(extents, map, id, count); @@ -676,9 +676,9 @@ static int projid_m_show(struct seq_file *seq, void *v) static void *m_start(struct seq_file *seq, loff_t *ppos, struct uid_gid_map *map) { + /* Pairs with smp_store_release() in map_write(). */ + unsigned int extents =3D smp_load_acquire(&map->nr_extents); loff_t pos =3D *ppos; - unsigned extents =3D map->nr_extents; - smp_rmb(); =20 if (pos >=3D extents) return NULL; @@ -967,9 +967,11 @@ static ssize_t map_write(struct file *file, const char= __user *buf, * desired behavior is to see the values of the extents that * were written before the count of the extents. * - * To achieve this smp_wmb() is used on guarantee the write - * order and smp_rmb() is guaranteed that we don't have crazy - * architectures returning stale data. + * The nr_extents field is the publish point for the extent + * data. Writers use smp_store_release() to ensure all extent + * data is visible before nr_extents is updated. Readers use + * smp_load_acquire() to ensure they see a consistent view of + * the extent data when reading nr_extents. */ mutex_lock(&userns_state_mutex); =20 @@ -1098,8 +1100,8 @@ static ssize_t map_write(struct file *file, const cha= r __user *buf, map->forward =3D new_map.forward; map->reverse =3D new_map.reverse; } - smp_wmb(); - map->nr_extents =3D new_map.nr_extents; + /* Pairs with smp_load_acquire() in map_id_range_{up,down}() and m_start(= ). */ + smp_store_release(&map->nr_extents, new_map.nr_extents); =20 *ppos =3D count; ret =3D count; --=20 2.34.1 From nobody Mon Sep 28 06:35:54 2026 Received: from canpmsgout02.his.huawei.com (canpmsgout02.his.huawei.com [113.46.200.217]) (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 BC3193F3284; Tue, 25 Aug 2026 09:53:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.217 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651632; cv=none; b=Y3VncoQoLhRiJsjH+rp/hjOXrg/tUioo39ouL4RRp+YeFsrmi7sYREobU50eax4W+cTlzAhiZhD6ActO7UJKm9J8YXJNOhCP8aYbzmMiZy9YD3UBKqk2Sxwj3JO2m+IlhGJNqZC+aRfzZTgd5AZHp2OQ49XHJIbRtATMbbelQc8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651632; c=relaxed/simple; bh=z0BxniLfOKINc495SO6dIMOCxgc3oRBRylFOj3iSnqw=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=gBnJs6GgP4ec7KyCS9Zjxi3X3IwVL5GTR5BmNsllpAzXOZV3dlnxDxZR9QH+9WFFQ3XhBSLq99nR/OHV9odlYDM6eqFKuWRhAQl6LDC7sK0Rq5s7My8KztRKy85OKcsqv8ikNBXN46dKGnOLpC2cpVWbTxsYg+/AoBuZhyDldwo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=DhkTcSxB; arc=none smtp.client-ip=113.46.200.217 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="DhkTcSxB" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=HgTAudJq8eHX15OWks05AWG/aS/PTGI/7ZST00bOn60=; b=DhkTcSxBxG6+QuFui1fAbXzMpP7OAunc0olvkVUBNqDQ6v01S+pCZQp8+ee2Q3wY1ABG4SW1x FGSDXE4D0XfgyxUvepAYHy5UmZZHnKo62+r7rU1wzucBTt6Y1Nw9GWce/qqKj4qMZTTCpbFWZ2i E1GaE6D5I7SSj8wsc7h/iqQ= Received: from mail.maildlp.com (unknown [172.19.163.104]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4hTjWj5vKxzcb0T; Tue, 25 Aug 2026 17:43:13 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id D8FB84058C; Tue, 25 Aug 2026 17:53:44 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Aug 2026 17:53:42 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH 02/11] lib/vsprintf: Use acquire/release for ptr_key publication Date: Tue, 25 Aug 2026 17:54:13 +0800 Message-ID: <20260825095422.3166067-3-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825095422.3166067-1-ruanjinjie@huawei.com> References: <20260825095422.3166067-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" Replace the smp_wmb() + WRITE_ONCE() and READ_ONCE() + smp_rmb() barrier pair with smp_store_release()/smp_load_acquire() on filled_random_ptr_key. This expresses the publish/subscribe pattern more clearly and allows architectures with native acquire/release instructions (e.g. arm64's STLR/LDAR) to avoid the cost of full one-way barriers (DMB ISHST/ISHLD). No functional change intended. Assisted-by: DeepSeek:DeepSeek-V3 Signed-off-by: Jinjie Ruan --- lib/vsprintf.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/vsprintf.c b/lib/vsprintf.c index e285e8bc4712..d6f235e143b7 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -762,9 +762,8 @@ static int fill_ptr_key(struct notifier_block *nb, unsi= gned long action, void *d { get_random_bytes(&ptr_key, sizeof(ptr_key)); =20 - /* Pairs with smp_rmb() before reading ptr_key. */ - smp_wmb(); - WRITE_ONCE(filled_random_ptr_key, true); + /* Pairs with smp_load_acquire() before reading ptr_key. */ + smp_store_release(&filled_random_ptr_key, true); return NOTIFY_DONE; } =20 @@ -781,12 +780,10 @@ static inline int __ptr_to_hashval(const void *ptr, u= nsigned long *hashval_out) { unsigned long hashval; =20 - if (!READ_ONCE(filled_random_ptr_key)) + /* Pairs with smp_store_release() after writing ptr_key. */ + if (!smp_load_acquire(&filled_random_ptr_key)) return -EBUSY; =20 - /* Pairs with smp_wmb() after writing ptr_key. */ - smp_rmb(); - #ifdef CONFIG_64BIT hashval =3D (unsigned long)siphash_1u64((u64)ptr, &ptr_key); /* --=20 2.34.1 From nobody Mon Sep 28 06:35:54 2026 Received: from canpmsgout05.his.huawei.com (canpmsgout05.his.huawei.com [113.46.200.220]) (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 BE7E73F44C0; Tue, 25 Aug 2026 09:53:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.220 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651640; cv=none; b=g0TYknEBJS/0alPsRsK+o6dzNaGheLuGhgbUW6g2pcJL7ztTwXkaXmPqEHp54GhQt0saJlqybfCfW11dEl0cXJnDQ8PG70cWqnFgrDMzhm8G++Gck1gOtOtIyZmI1bDlIKVivjXyJLlB+H+ss2UuGABHueQ57Io/CZdFqldawds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651640; c=relaxed/simple; bh=5YbyYcBJOD+o+4r3qugqMuOW8sHn5K230slHvsrAoRg=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=SbykvUunHeZ9JcN5lIp9q3LHPCMQnxv2NZxYwReSBTI2dkfSaiK/TIHismDPrXSHnkyi2YtyGsW2uyvGe9UUxVJZXZiw1ogCbdeh9dZSaHPU0Y0Z/o22rYN8kV1wROMUAUP5AwTiF5ew0xAEnWdkvBj/rnPVuIhI1+v12Bbm4Vg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=XunyHVOT; arc=none smtp.client-ip=113.46.200.220 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="XunyHVOT" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=6FRYJUOLTA6hN+N2W6YiLEyzvp6yWqiZW20zffxB2X4=; b=XunyHVOThjOrniLxP1oCSgBbF1UQukW4prmHS/b8pRwI+ADTsvqOU0SewIZGPU1nm8C/MoiHJ 9vTSJoZhEOVQZ5rt/bLMBgcs0NQ/ms0fpsGWTHcATUnXyteuoGR9YND8TvVJlkrptfmo5Wp8aoN Pv4GufSYlnKt0dtXPG6U1K0= Received: from mail.maildlp.com (unknown [172.19.163.104]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4hTjX115G0z12LDV; Tue, 25 Aug 2026 17:43:29 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id CB1874058C; Tue, 25 Aug 2026 17:53:46 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Aug 2026 17:53:44 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH 03/11] fs: aio: Use acquire/release for ring->tail publication Date: Tue, 25 Aug 2026 17:54:14 +0800 Message-ID: <20260825095422.3166067-4-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825095422.3166067-1-ruanjinjie@huawei.com> References: <20260825095422.3166067-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" Replace the smp_wmb() + WRITE_ONCE(ring->tail) and READ_ONCE(ring->tail) + smp_rmb() barrier pair with smp_store_release()/smp_load_acquire() on `ring->tail`. This expresses the publish/subscribe pattern more clearly and allows architectures with native acquire/release instructions (e.g. arm64's STLR/LDAR) to avoid the cost of full one-way barriers (DMB ISHST/ISHLD). The release ensures event data written before updating ring->tail is visible to readers that observe the new tail value via acquire, which is exactly the ordering the barrier pair provided. No functional change intended. Assisted-by: DeepSeek:DeepSeek-V3 Signed-off-by: Jinjie Ruan Reviewed-by: Jan Kara --- fs/aio.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/fs/aio.c b/fs/aio.c index d78acc69f487..4413c82688cc 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1206,13 +1206,12 @@ static void aio_complete(struct aio_kiocb *iocb) /* after flagging the request as done, we * must never even look at it again */ - smp_wmb(); /* make event visible before updating tail */ - - ctx->tail =3D tail; + WRITE_ONCE(ctx->tail, tail); =20 ring =3D folio_address(ctx->ring_folios[0]); head =3D ring->head; - ring->tail =3D tail; + /* Make event visible before updating tail */ + smp_store_release(&ring->tail, tail); flush_dcache_folio(ctx->ring_folios[0]); =20 ctx->completed_events++; @@ -1288,13 +1287,12 @@ static long aio_read_events_ring(struct kioctx *ctx, /* Access to ->ring_folios here is protected by ctx->ring_lock. */ ring =3D folio_address(ctx->ring_folios[0]); head =3D ring->head; - tail =3D ring->tail; - /* * Ensure that once we've read the current tail pointer, that * we also see the events that were stored up to the tail. + * Pairs with smp_store_release() in aio_complete(). */ - smp_rmb(); + tail =3D smp_load_acquire(&ring->tail); =20 pr_debug("h%u t%u m%u\n", head, tail, ctx->nr_events); =20 --=20 2.34.1 From nobody Mon Sep 28 06:35:54 2026 Received: from canpmsgout07.his.huawei.com (canpmsgout07.his.huawei.com [113.46.200.222]) (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 3D8603DA5A3; Tue, 25 Aug 2026 09:53:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.222 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651641; cv=none; b=tRc7xd60uc8QmZVfmEVUH3K5gzAWCpSlsBp/WjiVQGO4Ap7fbg2dD6l5WbrDURZljvlqih/UXNd2S+0pCXEd9j3jgGyzqR0X27hYQH4I/ySEfsy0tdzc/TW1RaWsz+lpeYl+GvggYADkKOmZyuYX6GMy0xLbWGpj1TwSCiJosdg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651641; c=relaxed/simple; bh=sP8Qz8Eqp5r1urJJ+9qmt0cVBLf49maB2A9Zk+1mGhA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KWD4qrwZyRhv1ZgYE9Adohs/TX/C3YkoS/c/ZhADeSB1/mCSkhqbN3rNYaY7dewzCXo/3EluP8vYaADg0D+/6fiZlo8LpK8qD6xg/nv1DLDRR0RfpGiO78/uLRlj7A9C3ZvEiBgl9HFIO06+xewzE3V2oXFUzKEA16+zrgLHy0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=ieTm4NuA; arc=none smtp.client-ip=113.46.200.222 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="ieTm4NuA" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=x49gazzv3KYmakJASIQB62Fhc5cLbTaH59g9EycQ3Ms=; b=ieTm4NuAnaXbrs5/IKYe8vNVkx5UE9YTzZ+tKb6uw6TSTu6eN3WC4Wm1yav+Xitkcv32zIQbb Q0dSnSXnWPi54+9uyCI5IGaQoIdddbqBnSNmSSvwyyjtVgeiBtjR3thAcaP7aR0wyrQVjn5uQeO oUNV8fa9Hw/1pEhV1juMAlE= Received: from mail.maildlp.com (unknown [172.19.163.15]) by canpmsgout07.his.huawei.com (SkyGuard) with ESMTPS id 4hTjWW4vcmzLlTm; Tue, 25 Aug 2026 17:43:03 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id A9B2A40578; Tue, 25 Aug 2026 17:53:48 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Aug 2026 17:53:46 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH 04/11] fs: Use acquire/release for fdtable resize synchronization Date: Tue, 25 Aug 2026 17:54:15 +0800 Message-ID: <20260825095422.3166067-5-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825095422.3166067-1-ruanjinjie@huawei.com> References: <20260825095422.3166067-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" Replace the smp_wmb()/smp_rmb() barrier pair with smp_store_release()/smp_load_acquire() on `files->resize_in_progress`. The flag is the publish point for fdtable expansion: writers clear it via release after rcu_assign_pointer(), readers check it via acquire before rcu_dereference_sched(). Observing it clear guarantees the new fdt pointer is visible. This expresses the pattern more clearly and allows cheaper one-way barriers on weakly-ordered architectures (e.g. arm64 STLR/LDAR vs DMB ISHST/ISHLD). Assisted-by: DeepSeek:DeepSeek-V3 Signed-off-by: Jinjie Ruan Reviewed-by: Jan Kara --- fs/file.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/fs/file.c b/fs/file.c index 628ca07dc4b1..86c035d459f2 100644 --- a/fs/file.c +++ b/fs/file.c @@ -273,8 +273,6 @@ static int expand_fdtable(struct files_struct *files, u= nsigned int nr) rcu_assign_pointer(files->fdt, new_fdt); if (cur_fdt !=3D &files->fdtab) call_rcu(&cur_fdt->rcu, free_fdtable_rcu); - /* coupled with smp_rmb() in fd_install() */ - smp_wmb(); return 0; } =20 @@ -313,7 +311,8 @@ static int expand_files(struct files_struct *files, uns= igned int nr) /* All good, so we try */ files->resize_in_progress =3D true; error =3D expand_fdtable(files, nr); - files->resize_in_progress =3D false; + /* coupled with smp_load_acquire() in fd_install() */ + smp_store_release(&files->resize_in_progress, false); =20 wake_up_all(&files->resize_wait); return error; @@ -685,13 +684,12 @@ void fd_install(unsigned int fd, struct file *file) return; =20 rcu_read_lock_sched(); - if (unlikely(files->resize_in_progress)) { + /* coupled with smp_store_release() in expand_files() */ + if (unlikely(smp_load_acquire(&files->resize_in_progress))) { rcu_read_unlock_sched(); fd_install_slowpath(fd, file); return; } - /* coupled with smp_wmb() in expand_fdtable() */ - smp_rmb(); fdt =3D rcu_dereference_sched(files->fdt); VFS_BUG_ON(rcu_access_pointer(fdt->fd[fd]) !=3D NULL); rcu_assign_pointer(fdt->fd[fd], file); --=20 2.34.1 From nobody Mon Sep 28 06:35:54 2026 Received: from canpmsgout04.his.huawei.com (canpmsgout04.his.huawei.com [113.46.200.219]) (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 471AE3E1D1D; Tue, 25 Aug 2026 09:53:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.219 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651642; cv=none; b=Mp0t4yO3Zil+DXu3ahnyoOBsgDxMZNUSuqGFvWymVHYOquXfyoo6mhRfrDjZ0ztv728pqM18aQwpJznlPC1oCPEl0LOarJEzraFHXrqlCbgaGAyau6kc5+wwygYKdpGdrmvy4Gqp5WHOMu1hOaMHD3FfBQTyb3rFFwKXAxIA+f0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651642; c=relaxed/simple; bh=iMa5wE77I9viKX+iq6hS3czdT7wNpnuYi++AAeXFJqA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AHEMG4Shak66ek2ZWKRB3bBMSIfE7pdf73CZXKkelPnb4W4/BhJn83KQQC0/KDw/ceEoW4Q9Pngv9V5eKB4dXteMAmrHnsrL6z1MnT7rI4p/qgzJYgCoOxLV2U5nZsaIGX0ezNrQgnk0Ipj5kGPSUsQcSXNJOvKiblYMyl9SHpk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=R+XDzKOd; arc=none smtp.client-ip=113.46.200.219 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="R+XDzKOd" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=uB34aPYIu0gFatrgKpoNzKkyjI+jIEUqunuY9fhb2Do=; b=R+XDzKOdPy44XUzj2S9qrgEIuJ2suw9oMDPeNT27lU6xRy6SP6v5YGX5s7yLA7V2aaYrPe9ai TIrxJQCkrbmWT4uYoIusdxvm99sBHGBAmgDilAOOPDA/Mo6bzKlo9ePceFFLHAb5fJOA/RHCh4+ ihKvFpENjOBXuPdUaXEp9/E= Received: from mail.maildlp.com (unknown [172.19.163.0]) by canpmsgout04.his.huawei.com (SkyGuard) with ESMTPS id 4hTjWW4cJpz1prQB; Tue, 25 Aug 2026 17:43:03 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 96CD240537; Tue, 25 Aug 2026 17:53:50 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Aug 2026 17:53:48 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH 05/11] pidfs: Use test_bit_acquire() for attr flag tests Date: Tue, 25 Aug 2026 17:54:16 +0800 Message-ID: <20260825095422.3166067-6-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825095422.3166067-1-ruanjinjie@huawei.com> References: <20260825095422.3166067-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" Replace test_bit() + smp_rmb() with test_bit_acquire() for PIDFS_ATTR_BIT_EXIT and PIDFS_ATTR_BIT_COREDUMP tests in pidfd_info(). The acquire semantics ensure that if the flag is observed set, the associated attr fields written before smp_wmb() + set_bit() are also visible. Writers keep smp_wmb() + set_bit() since no release bitop exists. Assisted-by: DeepSeek:DeepSeek-V3 Signed-off-by: Jinjie Ruan --- fs/pidfs.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/pidfs.c b/fs/pidfs.c index a6a643f15d08..2cd0fab73180 100644 --- a/fs/pidfs.c +++ b/fs/pidfs.c @@ -393,8 +393,7 @@ static long pidfd_info(struct file *file, unsigned int = cmd, unsigned long arg) =20 attr =3D READ_ONCE(pid->attr); if (mask & PIDFD_INFO_EXIT) { - if (test_bit(PIDFS_ATTR_BIT_EXIT, &attr->attr_mask)) { - smp_rmb(); + if (test_bit_acquire(PIDFS_ATTR_BIT_EXIT, &attr->attr_mask)) { kinfo.mask |=3D PIDFD_INFO_EXIT; #ifdef CONFIG_CGROUPS kinfo.cgroupid =3D attr->cgroupid; @@ -405,8 +404,7 @@ static long pidfd_info(struct file *file, unsigned int = cmd, unsigned long arg) } =20 if (mask & PIDFD_INFO_COREDUMP) { - if (test_bit(PIDFS_ATTR_BIT_COREDUMP, &attr->attr_mask)) { - smp_rmb(); + if (test_bit_acquire(PIDFS_ATTR_BIT_COREDUMP, &attr->attr_mask)) { kinfo.mask |=3D PIDFD_INFO_COREDUMP | PIDFD_INFO_COREDUMP_SIGNAL | PIDF= D_INFO_COREDUMP_CODE; kinfo.coredump_mask =3D attr->coredump_mask; kinfo.coredump_signal =3D attr->coredump_signal; --=20 2.34.1 From nobody Mon Sep 28 06:35:54 2026 Received: from canpmsgout10.his.huawei.com (canpmsgout10.his.huawei.com [113.46.200.225]) (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 F06C23F58F7; Tue, 25 Aug 2026 09:54:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.225 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651644; cv=none; b=n7vuBlx1wcUMSpye+gvNyACKa536C2QaNPviuzV8X43Gq6WcmjGjC99uWfRpIqFAIaXjJYVhv6/3oKcD0Hye4pgtXVX+gY7HTIbtyhywqQb05I4BXr9n3q471twXQhJYcP8y7UAcP9ontDQ90jBLO8PJHlobbZVZwdN4OfEWmGQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651644; c=relaxed/simple; bh=9VX9tNxmeiNKMUZmwh7YDzBNqN4eQ+31Q0u7K6Vy2wA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ZixBKVMOsz9icVS3QlO8TVx21MdUC/LGliUKFqsTrfCB+0vivjT5VfsKORRtRQw9+GvdaxeffSqO64yulKIJ7O030vDP5ZzWUMWzqnIlZHUBEkMB3AywAQ9GeOfg8cbzASRHm4ms51SIxN5OGSMMq1tSYkBqYZyd4ju3EvaEWuw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=gIdVxCQH; arc=none smtp.client-ip=113.46.200.225 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="gIdVxCQH" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=8sPKKDcZB2un5eRi6hOumnki0mdxkjaC8IL+SruPwMw=; b=gIdVxCQHr5Il4Bx2DPju27DKp6wMWMKNbSmPAhbOEVnUhFaoiGOBw4y5me6l9kZ2Jam81LP4t AJewY0GkDv33/SgEEGSoLQ/5Q0LL5JX4tMDbGqdxalHUXQE//+MZ/LGNubcYMnwFoMQpywZdgIW 7LlDiiS1v1tXSErIckpJImQ= Received: from mail.maildlp.com (unknown [172.19.163.15]) by canpmsgout10.his.huawei.com (SkyGuard) with ESMTPS id 4hTjWb2MY6z1K9BV; Tue, 25 Aug 2026 17:43:07 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 7DE8B40578; Tue, 25 Aug 2026 17:53:52 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Aug 2026 17:53:50 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH 06/11] super: Use acquire for SB_BORN check in super_cache_count() Date: Tue, 25 Aug 2026 17:54:17 +0800 Message-ID: <20260825095422.3166067-7-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825095422.3166067-1-ruanjinjie@huawei.com> References: <20260825095422.3166067-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" The active SB_BORN check in super_cache_count() pairs with the smp_store_release() in super_wake() when publishing a newly initialized superblock. Replace the historical independent smp_rmb() barrier with an acquire load on sb->s_flags. This expresses the publish-subscribe pattern more clearly and allows weakly-ordered architectures like arm64 to utilize efficient native instructions (e.g., LDAR) instead of a full one-way barrier. Also update the outdated comment to correctly point to super_wake(). Assisted-by: Gemini:Gemini-3.1 Assisted-by: DeepSeek:DeepSeek-V3 Signed-off-by: Jinjie Ruan Reviewed-by: Jan Kara --- fs/super.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/super.c b/fs/super.c index 05e443173038..5860daea6d40 100644 --- a/fs/super.c +++ b/fs/super.c @@ -267,12 +267,11 @@ static unsigned long super_cache_count(struct shrinke= r *shrink, * However, if we are currently mounting the superblock, the underlying * filesystem might be in a state of partial construction and hence it * is dangerous to access it. super_trylock_shared() uses a SB_BORN check - * to avoid this situation, so do the same here. The memory barrier is - * matched with the one in mount_fs() as we don't hold locks here. + * to avoid this situation, so do the same here. The acquire is matched + * with the smp_store_release() in super_wake() as we don't hold locks he= re. */ - if (!(sb->s_flags & SB_BORN)) + if (!(smp_load_acquire(&sb->s_flags) & SB_BORN)) return 0; - smp_rmb(); =20 if (sb->s_op && sb->s_op->nr_cached_objects && super_fs_objects_eligible(sc)) --=20 2.34.1 From nobody Mon Sep 28 06:35:54 2026 Received: from canpmsgout10.his.huawei.com (canpmsgout10.his.huawei.com [113.46.200.225]) (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 CB2B03FB06D; Tue, 25 Aug 2026 09:54:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.225 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651645; cv=none; b=cKJq6rkr+58ZpV9KWwxPXrt5nf7N2VR1dn7Phep2Mtqd5oXn20/56Km0s3SJi9q+8MQLr+fd6lrI6kyGfH35ppt9BXhNjN2e2A1YBv/1qa8o8sumX+ddP/sn9hsq8YTukJ5DfUu+81EDo68cGeRdAlcv0DXnWsDZjIVa8Ver82I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651645; c=relaxed/simple; bh=la5SIXh7VmOWGNdBMkVtitWg5X6h0luDBgmfHpw8bZQ=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=KgrdlCONu2xbelK8/I8ZbLBv2v1ZLV3Hjmal4Qm0crvcslhSzUCn++Rub7nJSPer+XJfGFOkKndgtpsOd2Kk6XwjzxHIDyUrHVtTqwIwUd+Rm2QszOuGwE+cLVYJlTvIUbtXWa3rsIkm57e2M1wHQPF6Yb/xLCea86V30YImpyk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=zqLw0SmT; arc=none smtp.client-ip=113.46.200.225 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="zqLw0SmT" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=0y/8nOHVwx4gd6YkQJrH19CZDSX5NFv5nerKnpz559g=; b=zqLw0SmTgcAmrAmtZ1/OivLzntqgkQr31UYG/wwciFKdvURjaGaafU/N4jfSdDCypMp9lG1GJ M0gbbjETsWsHB4+NThl0jY08Pnyn28ksoTjnTXSMtYKL3Qtn4vflGGiql5x23MykQ23ZAspc5Xc 5vS1gp5hH8cnh//bs7xokvQ= Received: from mail.maildlp.com (unknown [172.19.162.92]) by canpmsgout10.his.huawei.com (SkyGuard) with ESMTPS id 4hTjWd1mMVz1K9BV; Tue, 25 Aug 2026 17:43:09 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 6A06F40565; Tue, 25 Aug 2026 17:53:54 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Aug 2026 17:53:52 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH 07/11] ext4: Convert group-count barrier protocol to acquire/release Date: Tue, 25 Aug 2026 17:54:18 +0800 Message-ID: <20260825095422.3166067-8-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825095422.3166067-1-ruanjinjie@huawei.com> References: <20260825095422.3166067-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" During an online resize, reading s_groups_count and s_blockfile_groups requires strict ordering against subsequent initialized block group metadata. Replace the historical smp_wmb()/smp_rmb() pairs with smp_store_release() and smp_load_acquire(). This formalizes the publish-subscribe pattern and allows weakly-ordered architectures (e.g., arm64) to utilize native STLR/LDAR instructions instead of full DMB fences. Update the documentation in resize.c and ext4.h accordingly. Assisted-by: Gemini:Gemini-3.1 Assisted-by: DeepSeek:DeepSeek-V3 Signed-off-by: Jinjie Ruan Reviewed-by: Jan Kara Reviewed-by: Zhang Yi --- fs/ext4/ext4.h | 10 +++------- fs/ext4/mballoc.c | 6 ++---- fs/ext4/resize.c | 19 +++++++++++-------- 3 files changed, 16 insertions(+), 19 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 724a27e8be61..d70b9cb09155 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -3542,16 +3542,12 @@ static inline void ext4_isize_set(struct ext4_inode= *raw_inode, loff_t i_size) } =20 /* - * Reading s_groups_count requires using smp_rmb() afterwards. See - * the locking protocol documented in the comments of ext4_group_add() - * in resize.c + * Reading s_groups_count uses acquire semantics. */ static inline ext4_group_t ext4_get_groups_count(struct super_block *sb) { - ext4_group_t ngroups =3D EXT4_SB(sb)->s_groups_count; - - smp_rmb(); - return ngroups; + /* Pairs with smp_store_release() in ext4_update_super() */ + return smp_load_acquire(&EXT4_SB(sb)->s_groups_count); } =20 static inline ext4_group_t ext4_flex_group(struct ext4_sb_info *sbi, diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 06171a11db12..a15285224cdf 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -899,10 +899,8 @@ static ext4_group_t ext4_get_allocation_groups_count( =20 /* non-extent files are limited to low blocks/groups */ if (!(ext4_test_inode_flag(ac->ac_inode, EXT4_INODE_EXTENTS))) - ngroups =3D EXT4_SB(ac->ac_sb)->s_blockfile_groups; - - /* Pairs with smp_wmb() in ext4_update_super() */ - smp_rmb(); + /* Pairs with smp_store_release() in ext4_update_super() */ + ngroups =3D smp_load_acquire(&EXT4_SB(ac->ac_sb)->s_blockfile_groups); =20 return ngroups; } diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c index 2c5b851c552a..5e3ad8393cf8 100644 --- a/fs/ext4/resize.c +++ b/fs/ext4/resize.c @@ -1462,11 +1462,11 @@ static void ext4_update_super(struct super_block *s= b, * * The precise rules we use are: * - * * Writers must perform a smp_wmb() after updating all - * dependent data and before modifying the groups count + * * Writers must use a release store when updating the groups count + * after all dependent data has been updated * - * * Readers must perform an smp_rmb() after reading the groups - * count and before reading any dependent data. + * * Readers must use an acquire load when reading the groups + * count before reading any dependent data. * * NB. These rules can be relaxed when checking the group count * while freeing data, as we can only allocate from a block @@ -1474,12 +1474,15 @@ static void ext4_update_super(struct super_block *s= b, * only then free after serialising in turn against that * allocation. */ - smp_wmb(); =20 /* Update the global fs size fields */ - sbi->s_groups_count +=3D flex_gd->count; - sbi->s_blockfile_groups =3D min(sbi->s_groups_count, - (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb))); + /* Pairs with smp_load_acquire() in ext4_get_groups_count() */ + smp_store_release(&sbi->s_groups_count, + sbi->s_groups_count + flex_gd->count); + /* Pairs with smp_load_acquire() in ext4_get_allocation_groups_count() */ + smp_store_release(&sbi->s_blockfile_groups, + min(sbi->s_groups_count, + (EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP(sb)))); =20 /* Update the reserved block counts only once the new group is * active. */ --=20 2.34.1 From nobody Mon Sep 28 06:35:54 2026 Received: from canpmsgout03.his.huawei.com (canpmsgout03.his.huawei.com [113.46.200.218]) (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 A90463DA5C5; Tue, 25 Aug 2026 09:53:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651642; cv=none; b=Q+gSuwkaS/D3+wFacatS1Es/ahR12lFRksLLiglVVHqjB5T2f/1cxz8lH4p9ZuOGXdtuCGzXBh8Ni4SOhZiRKsK2SN2KfLygzs5/cNoaGO9MJXf6SM8qHGohafENdgJ6wfabGSK+t2E3d+XfrCkd1YmkYnPf2jlFhbhyg/PjBcg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651642; c=relaxed/simple; bh=Z35ePei/QyXNJ5AewGWCEjdFNWAAxaH7ykgYKESbCwA=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=bgYCnH04E5IYUeNPy3/7XLcKTLvAm17XVnGcUEjeaFQh9yXUViK68WHCpLSBGtZ58EKUwtciEzZ7yxjLy3pdPVTE7tvRqRa5cxWhdFfqim5ntsIhlL/1ktTtSlT3XgHsYiqU2+AzlevyTVxTc5jVflDd653hXwCYv9rXDS8FPXU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=fVfh6m5T; arc=none smtp.client-ip=113.46.200.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="fVfh6m5T" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=J6Z3R61B1Bih/Ax1lTgFVPe2AKAV13hl3xrbb4fy5uU=; b=fVfh6m5T3nT8C5mQN0/TWRlBwYFBOEmuyYdU3jNF4lTiGYWflLdfMqFu4BA+VNpiPQjW6XJ7G auW2bISPGxUbY+4/pcDke2TV1K3Zbqmf9kjvmiht1QV4ZPqNd8mfipvyuYhP9W4RNtkwo163xve 5f60+A/uYlzYhqPOjd+AdRA= Received: from mail.maildlp.com (unknown [172.19.163.104]) by canpmsgout03.his.huawei.com (SkyGuard) with ESMTPS id 4hTjWF4nWtzpT0h; Tue, 25 Aug 2026 17:42:49 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 526CC4058C; Tue, 25 Aug 2026 17:53:56 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Aug 2026 17:53:54 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH 08/11] soreuseport: publish num_socks with acquire/release Date: Tue, 25 Aug 2026 17:54:19 +0800 Message-ID: <20260825095422.3166067-9-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825095422.3166067-1-ruanjinjie@huawei.com> References: <20260825095422.3166067-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" Replace the smp_wmb()/smp_rmb() barrier pair with smp_store_release()/smp_load_acquire() on reuse->num_socks. Writers publish socks[] updates via release before incrementing or decrementing the count; readers acquire the count before accessing socks[], ensuring they observe a consistent view. The detach path gains proper ordering between the socks[] write and the decrement, which was previously unordered. No functional change intended. Assisted-by: DeepSeek:DeepSeek-V3 Signed-off-by: Jinjie Ruan --- net/core/sock_reuseport.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/net/core/sock_reuseport.c b/net/core/sock_reuseport.c index 29948cb44b7d..6d3c511d1def 100644 --- a/net/core/sock_reuseport.c +++ b/net/core/sock_reuseport.c @@ -125,9 +125,8 @@ static void __reuseport_add_sock(struct sock *sk, struct sock_reuseport *reuse) { reuse->socks[reuse->num_socks] =3D sk; - /* paired with smp_rmb() in reuseport_(select|migrate)_sock() */ - smp_wmb(); - reuse->num_socks++; + /* paired with smp_load_acquire() in reuseport_(select|migrate)_sock() */ + smp_store_release(&reuse->num_socks, reuse->num_socks + 1); reuseport_get_incoming_cpu(sk, reuse); } =20 @@ -140,7 +139,8 @@ static bool __reuseport_detach_sock(struct sock *sk, return false; =20 reuse->socks[i] =3D reuse->socks[reuse->num_socks - 1]; - reuse->num_socks--; + /* paired with smp_load_acquire() in reuseport_(select|migrate)_sock() */ + smp_store_release(&reuse->num_socks, reuse->num_socks - 1); reuseport_put_incoming_cpu(sk, reuse); =20 return true; @@ -583,11 +583,9 @@ struct sock *reuseport_select_sock(struct sock *sk, goto out; =20 prog =3D rcu_dereference(reuse->prog); - socks =3D READ_ONCE(reuse->num_socks); + /* paired with smp_store_release() in __reuseport_add_sock() */ + socks =3D smp_load_acquire(&reuse->num_socks); if (likely(socks)) { - /* paired with smp_wmb() in __reuseport_add_sock() */ - smp_rmb(); - if (!prog || !skb) goto select_by_hash; =20 @@ -634,13 +632,11 @@ struct sock *reuseport_migrate_sock(struct sock *sk, if (!reuse) goto out; =20 - socks =3D READ_ONCE(reuse->num_socks); + /* paired with smp_store_release() in __reuseport_add_sock() */ + socks =3D smp_load_acquire(&reuse->num_socks); if (unlikely(!socks)) goto failure; =20 - /* paired with smp_wmb() in __reuseport_add_sock() */ - smp_rmb(); - hash =3D migrating_sk->sk_hash; prog =3D rcu_dereference(reuse->prog); if (!prog || prog->expected_attach_type !=3D BPF_SK_REUSEPORT_SELECT_OR_M= IGRATE) { --=20 2.34.1 From nobody Mon Sep 28 06:35:54 2026 Received: from canpmsgout01.his.huawei.com (canpmsgout01.his.huawei.com [113.46.200.216]) (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 2FAEA3F99E3; Tue, 25 Aug 2026 09:54:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.216 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651645; cv=none; b=UdmOXnbXm8V8KkI1E/7UeteyH/iTtwcnOPk2qNTwk6q52AQ/O1C09jDD3YWN8U2pImyInOxZhuATjMq5EnAZ6ZPbGU20uuh3/yNwAs2uNdlSG3ZYovpW12PkVUupWeQq9K2AMQXJII2mLVSbui6l00oTcMrHN+XEXjei5whTgLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651645; c=relaxed/simple; bh=YHPKagm1+brOllx+9HjiRfO+T8k3k5DTtjYMuEzl4cY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=rw7tWIaQmQH2LmbxQY2oryFGeYoVr2cNMIlq/NimE6VgAbTAGtJQi2wEKWJZmJTa3xIV83X260p2gbIW3pYWWf6BcJfSOPW2Se/eiQX057tzIgTzfHijvjRw0V28AFuwEdvKSGuRXkEzXQiY7Wct8acXyYN8byDdVE6Jf33I4kY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=pv78ql9T; arc=none smtp.client-ip=113.46.200.216 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="pv78ql9T" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=n2rOlDHSg923uKF19dgYoacryfpqA16TA+EsTrrgL/o=; b=pv78ql9TY9058OtNO5LvmA4H7jBpYx3OKhlPYYCwzCjyirI4JN5udw2lPbCxRrFqjxLQJT3xS iMD1iUdx+ChRubUdoqqVXThmZiu+idvUiKgCVNFOH/uAOj1vq+1CM2s3203d9/gDyjnhgnYRkEB 9RBwTxjYv8/jgRQy/hVuS4w= Received: from mail.maildlp.com (unknown [172.19.163.0]) by canpmsgout01.his.huawei.com (SkyGuard) with ESMTPS id 4hTjXP2Sbgz1T4MQ; Tue, 25 Aug 2026 17:43:49 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 3E3F04057A; Tue, 25 Aug 2026 17:53:58 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Aug 2026 17:53:56 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH 09/11] net: sched: act_gact: use acquire/release for tcfg_ptype Date: Tue, 25 Aug 2026 17:54:20 +0800 Message-ID: <20260825095422.3166067-10-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825095422.3166067-1-ruanjinjie@huawei.com> References: <20260825095422.3166067-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" Replace the smp_wmb()/smp_rmb() barrier pair with smp_store_release()/smp_load_acquire() on gact->tcfg_ptype. tcf_gact_init() publishes tcfg_ptype via release after writing tcfg_pval/tcfg_paction; tcf_gact_act() acquires it before dispatching to gact_net_rand()/gact_determ(), ensuring the probability parameters are visible. No functional change intended. Assisted-by: DeepSeek:DeepSeek-V3 Signed-off-by: Jinjie Ruan --- net/sched/act_gact.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/net/sched/act_gact.c b/net/sched/act_gact.c index 565860cccba6..d4f39f98e2cf 100644 --- a/net/sched/act_gact.c +++ b/net/sched/act_gact.c @@ -25,7 +25,6 @@ static struct tc_action_ops act_gact_ops; #ifdef CONFIG_GACT_PROB static int gact_net_rand(struct tcf_gact *gact) { - smp_rmb(); /* coupled with smp_wmb() in tcf_gact_init() */ if (get_random_u32_below(gact->tcfg_pval)) return gact->tcf_action; return gact->tcfg_paction; @@ -35,7 +34,6 @@ static int gact_determ(struct tcf_gact *gact) { u32 pack =3D atomic_inc_return(&gact->packets); =20 - smp_rmb(); /* coupled with smp_wmb() in tcf_gact_init() */ if (pack % gact->tcfg_pval) return gact->tcf_action; return gact->tcfg_paction; @@ -133,11 +131,8 @@ static int tcf_gact_init(struct net *net, struct nlatt= r *nla, if (p_parm) { gact->tcfg_paction =3D p_parm->paction; gact->tcfg_pval =3D max_t(u16, 1, p_parm->pval); - /* Make sure tcfg_pval is written before tcfg_ptype - * coupled with smp_rmb() in gact_net_rand() & gact_determ() - */ - smp_wmb(); - gact->tcfg_ptype =3D p_parm->ptype; + /* Pairs with smp_load_acquire() in tcf_gact_act(). */ + smp_store_release(&gact->tcfg_ptype, p_parm->ptype); } #endif spin_unlock_bh(&gact->tcf_lock); @@ -160,7 +155,8 @@ TC_INDIRECT_SCOPE int tcf_gact_act(struct sk_buff *skb, =20 #ifdef CONFIG_GACT_PROB { - u32 ptype =3D READ_ONCE(gact->tcfg_ptype); + /* Pairs with smp_store_release() in tcf_gact_init() */ + u32 ptype =3D smp_load_acquire(&gact->tcfg_ptype); =20 if (ptype) action =3D gact_rand[ptype](gact); --=20 2.34.1 From nobody Mon Sep 28 06:35:54 2026 Received: from canpmsgout09.his.huawei.com (canpmsgout09.his.huawei.com [113.46.200.224]) (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 CB15E3FB055; Tue, 25 Aug 2026 09:54:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.224 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651646; cv=none; b=dnsILqVOWxbT3nkDXrKLbkQswmg/OuDtMQkcZdTJceEI31mEZ2pNh39iqjZukr16QBSyv/YU+punEcV87zkTgvn80UTwDj4QCSIHty7AWTVWyNICc9y6OpdAWp/z3sn83b23Ez/kJNNageuK5Lzu/mutvxNA35s0Uw4aDGRnkFw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651646; c=relaxed/simple; bh=XNBSpVHvQ/skL0QPySFaWZ90V7U+qoF6u8zFYzU2KAI=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PoFITP70ePjcgn0pSepAAyDRSlFGEN0yaANG76xNeECNcFxwORfl5wRVPbo4KIteoVuk+z7LS0O/fQHeo6vt9i3zvGf6XKihiRnb/tXHc74pE6hBf9jBp+TFqPV2EqspOiI4IzAjCMD4wuVw9vG+dGutWCk/ZTN6fob7Df68pww= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=rIgop2Bp; arc=none smtp.client-ip=113.46.200.224 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="rIgop2Bp" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=LFpSehcyWw3Y5kI9RuGM4x6gwDDus7uImypv1l9XmUc=; b=rIgop2BpX302wWzEzJXEEj0c/j/JwUX9pZgVh33DZYD4iHm5PlMWgX6FvkTb4EURkqw5YM6t+ 1gMKEIciAGJTn2knTbDafplxmKREtnS5ejmRZVpB2s/5Z5so33Vu2v97nO29+T7PI0bIe3KD1NP /jkIs64DvAWhLsiQ9L8Zqkw= Received: from mail.maildlp.com (unknown [172.19.163.127]) by canpmsgout09.his.huawei.com (SkyGuard) with ESMTPS id 4hTjWl5j2yz1cyT9; Tue, 25 Aug 2026 17:43:15 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 29B93402AB; Tue, 25 Aug 2026 17:54:00 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Aug 2026 17:53:58 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH 10/11] 8021q: publish vlan_devices_arrays entries with acquire/release Date: Tue, 25 Aug 2026 17:54:21 +0800 Message-ID: <20260825095422.3166067-11-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825095422.3166067-1-ruanjinjie@huawei.com> References: <20260825095422.3166067-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" Replace the smp_wmb()/smp_rmb() barrier pair with smp_store_release()/smp_load_acquire() on vg->vlan_devices_arrays[pidx][vidx]. vlan_group_prealloc_vid() publishes the array pointer via release; __vlan_group_get_device() acquires it before accessing the array, ensuring the allocated entries are visible. No functional change intended. Assisted-by: DeepSeek:DeepSeek-V3 Signed-off-by: Jinjie Ruan --- net/8021q/vlan.c | 6 ++---- net/8021q/vlan.h | 8 +++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 2d2efb877975..e34ada0cceac 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -70,10 +70,8 @@ static int vlan_group_prealloc_vid(struct vlan_group *vg, if (array =3D=3D NULL) return -ENOBUFS; =20 - /* paired with smp_rmb() in __vlan_group_get_device() */ - smp_wmb(); - - vg->vlan_devices_arrays[pidx][vidx] =3D array; + /* paired with smp_load_acquire() in __vlan_group_get_device() */ + smp_store_release(&vg->vlan_devices_arrays[pidx][vidx], array); return 0; } =20 diff --git a/net/8021q/vlan.h b/net/8021q/vlan.h index c41caaf94095..6db7172bdaac 100644 --- a/net/8021q/vlan.h +++ b/net/8021q/vlan.h @@ -56,11 +56,9 @@ static inline struct net_device *__vlan_group_get_device= (struct vlan_group *vg, { struct net_device **array; =20 - array =3D vg->vlan_devices_arrays[pidx] - [vlan_id / VLAN_GROUP_ARRAY_PART_LEN]; - - /* paired with smp_wmb() in vlan_group_prealloc_vid() */ - smp_rmb(); + /* Pairs with smp_store_release() in vlan_group_prealloc_vid() */ + array =3D smp_load_acquire(&vg->vlan_devices_arrays[pidx] + [vlan_id / VLAN_GROUP_ARRAY_PART_LEN]); =20 return array ? array[vlan_id % VLAN_GROUP_ARRAY_PART_LEN] : NULL; } --=20 2.34.1 From nobody Mon Sep 28 06:35:54 2026 Received: from canpmsgout08.his.huawei.com (canpmsgout08.his.huawei.com [113.46.200.223]) (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 22E7C3F54A0; Tue, 25 Aug 2026 09:54:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.223 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651653; cv=none; b=X1ZxjgtLs47o6qbS1iPDhjCBS/LNDazWYbhp54Ffhstr8/xmdXxK1tKIeE9VJpksivbYIJo7LehJrV8/m8ZiSrQK6ImHBG42qYXYRQQOqrYj1CXqCOvsAj397fxUP4YiR26G8jszI6NZQh/e+ZQHK3ly8krzro9sO8fn/YPHtCk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1787651653; c=relaxed/simple; bh=vmhjgqu4evWlBUI6tNjlRBCU4UfRqEc/jY1DimltO7E=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qdV+9QZDUbEGYFEMYhhG2AYuPCUUb96KlUFVdZUJAPzGUO2Qls3vwk7K9yA4iwCYBt1AlGI5pg46aiNdJ67U0KeS34Rq1j7G+FMwftviJaX9QAhg7SO+Lalv272JFddxg8uVgSmmy7Gh91A39KR1cBpbHWuJMY9Bg5JZyHQmafE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=QuTizBvZ; arc=none smtp.client-ip=113.46.200.223 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b="QuTizBvZ" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=kLuSQCasskPYYSTYdCUYQ9AeYdxAoMlIQ8GTnnTcWE4=; b=QuTizBvZQBJR6MMk8yU0Kw5pB6Ut9Nb0ABl+lfisxX2p6nCcM7rkUuLgCfuZLE424ahAyNv/G DvKFSk44c6hg8C55c5dFw3LWiyFNwSIoJN/GqbyBDd/b2dhmUYSCOLl1yt30opD9Xo+QJ8yyfFQ FZ+nNQ6zFfrCX7eSukYK5AU= Received: from mail.maildlp.com (unknown [172.19.163.200]) by canpmsgout08.his.huawei.com (SkyGuard) with ESMTPS id 4hTjWm6GsNzmV91; Tue, 25 Aug 2026 17:43:16 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 12F5E4055B; Tue, 25 Aug 2026 17:54:02 +0800 (CST) Received: from huawei.com (10.90.53.73) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Tue, 25 Aug 2026 17:54:00 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH 11/11] can: isotp: publish tx.state with smp_store_release() Date: Tue, 25 Aug 2026 17:54:22 +0800 Message-ID: <20260825095422.3166067-12-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260825095422.3166067-1-ruanjinjie@huawei.com> References: <20260825095422.3166067-1-ruanjinjie@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: kwepems200001.china.huawei.com (7.221.188.67) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" The writer already pairs with the smp_load_acquire() readers in isotp_tx_timeout()/isotp_tx_gen_done(); convert the smp_wmb() + WRITE_ONCE() into a release store. Assisted-by: DeepSeek:DeepSeek-V3 Signed-off-by: Jinjie Ruan --- net/can/isotp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/can/isotp.c b/net/can/isotp.c index 155530aedce2..11b653ba7c10 100644 --- a/net/can/isotp.c +++ b/net/can/isotp.c @@ -1156,8 +1156,8 @@ static int isotp_sendmsg(struct socket *sock, struct = msghdr *msg, size_t size) my_gen =3D isotp_inc_tx_gen(READ_ONCE(so->tx_gen)); isotp_set_tx_result(so, my_gen, ECOMM); /* prevent stale slot matching */ WRITE_ONCE(so->tx_gen, my_gen); - smp_wmb(); /* see smp_load_acquire() in isotp_tx_[timeout|gen_done] */ - WRITE_ONCE(so->tx.state, ISOTP_SENDING); + /* Pairs with smp_load_acquire() in isotp_tx_[timeout|gen_done] */ + smp_store_release(&so->tx.state, ISOTP_SENDING); WRITE_ONCE(so->cfecho, 0); spin_unlock_bh(&so->rx_lock); =20 --=20 2.34.1