From nobody Fri Dec 19 10:41:38 2025 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 D62412139A1 for ; Mon, 2 Sep 2024 14:09:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725286187; cv=none; b=jVd6KOkDXTAJQt7K8w4wWQWQwVCnCHzogKFFKF/Apv+rTrdUIXf8Km33IZvrXZdCVviotVOYYO4Ec4paOGq7iniqfQL0MSeLuh+gLG6kDI8SfFdc+GxQ7EFFB+hG6r376N2DdwN7vul8JhFNWaU/dJ2REAoSJrfKS1e3Ix7YAkQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725286187; c=relaxed/simple; bh=lMwmFHmCi+nOQxA0agkXT33ljy87fXmy942ayPk0K9o=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=lNml+1hsmeZNzoSaWaSjIQwT3kdm0W2JSEY/erHjSYBVAbXSFb6ihEvl+BaQnO4mMLKDz9Snc4EhaufXsmxkNy4QXEnLteOUd/oiKnnomts+rCjAulELDRoEsBTZr7priYaP+AZZzl1S2H2yNglAdIYCXThiOa4ZZIkXJfWtM3U= 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; arc=none smtp.client-ip=45.249.212.188 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 Received: from mail.maildlp.com (unknown [172.19.88.105]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Wy9Yz3FtvzgYqx; Mon, 2 Sep 2024 22:07:35 +0800 (CST) Received: from dggpemf100006.china.huawei.com (unknown [7.185.36.228]) by mail.maildlp.com (Postfix) with ESMTPS id C9F7A1400D1; Mon, 2 Sep 2024 22:09:41 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemf100006.china.huawei.com (7.185.36.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 2 Sep 2024 22:09:41 +0800 From: Zhen Lei To: Andrew Morton , Thomas Gleixner , CC: Zhen Lei Subject: [PATCH 1/5] debugobjects: Fix the misuse of global variables in fill_pool() Date: Mon, 2 Sep 2024 22:05:28 +0800 Message-ID: <20240902140532.2028-2-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.37.3.windows.1 In-Reply-To: <20240902140532.2028-1-thunder.leizhen@huawei.com> References: <20240902140532.2028-1-thunder.leizhen@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: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemf100006.china.huawei.com (7.185.36.228) Content-Type: text/plain; charset="utf-8" The global variable 'obj_pool_min_free' records the lowest historical value of the number of nodes in the global list 'obj_pool', instead of being used as the lowest threshold value. This may be a mistake and should be replaced with variable 'debug_objects_pool_min_level'. Fixes: d26bf5056fc0 ("debugobjects: Reduce number of pool_lock acquisitions= in fill_pool()") Fixes: 36c4ead6f6df ("debugobjects: Add global free list and the counter") Signed-off-by: Zhen Lei --- lib/debugobjects.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/debugobjects.c b/lib/debugobjects.c index 7cea91e193a8f04..1ea8af72849cdb1 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -142,13 +142,14 @@ static void fill_pool(void) * READ_ONCE()s pair with the WRITE_ONCE()s in pool_lock critical * sections. */ - while (READ_ONCE(obj_nr_tofree) && (READ_ONCE(obj_pool_free) < obj_pool_m= in_free)) { + while (READ_ONCE(obj_nr_tofree) && + READ_ONCE(obj_pool_free) < debug_objects_pool_min_level) { raw_spin_lock_irqsave(&pool_lock, flags); /* * Recheck with the lock held as the worker thread might have * won the race and freed the global free list already. */ - while (obj_nr_tofree && (obj_pool_free < obj_pool_min_free)) { + while (obj_nr_tofree && (obj_pool_free < debug_objects_pool_min_level)) { obj =3D hlist_entry(obj_to_free.first, typeof(*obj), node); hlist_del(&obj->node); WRITE_ONCE(obj_nr_tofree, obj_nr_tofree - 1); --=20 2.34.1 From nobody Fri Dec 19 10:41:38 2025 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 0BDA32139A2 for ; Mon, 2 Sep 2024 14:09:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725286188; cv=none; b=HOwLSZD45Pkg2gNqOqZiCO0s7kXBawReqHr6r3aVx4YVMgebeYprLXDmsgycyrMfZX7iQEDSyKvdL32HqG7uWu4f/1J7iKWb5gn6Btf1fxWHWsTeygWo3mqGRE8pwa4+T9mRWfpRru8RjPGIvFbiekgkClPVst4/B9liBwKOALk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725286188; c=relaxed/simple; bh=vwY9EPrT8amryegjt5G92JC+4cXSQnZdKcMxvJhBW54=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=akGOXWwdmtvqwnIQ3kKiunA4jAPkLlabb5Osx9BpXyWaaZDM04Qf2oa83FkQzEaz9OGJNbBw24Q7uzpZ2IDorCqVmuRWrFjhgWSQnnrt53rCA4CQPGI/1Edlp/XKTHbkIU1ZBUeddaWhP0eHqL3pz1NbkXj2CIPyksDhXjckaw4= 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; arc=none smtp.client-ip=45.249.212.191 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 Received: from mail.maildlp.com (unknown [172.19.88.234]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Wy9XS5dBjz1HJ3S; Mon, 2 Sep 2024 22:06:16 +0800 (CST) Received: from dggpemf100006.china.huawei.com (unknown [7.185.36.228]) by mail.maildlp.com (Postfix) with ESMTPS id 3C26F140360; Mon, 2 Sep 2024 22:09:42 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemf100006.china.huawei.com (7.185.36.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 2 Sep 2024 22:09:41 +0800 From: Zhen Lei To: Andrew Morton , Thomas Gleixner , CC: Zhen Lei Subject: [PATCH 2/5] debugobjects: Remove redundant checks in fill_pool() Date: Mon, 2 Sep 2024 22:05:29 +0800 Message-ID: <20240902140532.2028-3-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.37.3.windows.1 In-Reply-To: <20240902140532.2028-1-thunder.leizhen@huawei.com> References: <20240902140532.2028-1-thunder.leizhen@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: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemf100006.china.huawei.com (7.185.36.228) Content-Type: text/plain; charset="utf-8" The conditions for the inner and outer loops are exactly the same, so the outer 'while' should be changed to 'if'. Then we'll see that the second condition of the new 'if' is already guaranteed above and can be removed. Signed-off-by: Zhen Lei --- lib/debugobjects.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/debugobjects.c b/lib/debugobjects.c index 1ea8af72849cdb1..aba3e62a4315f51 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -142,8 +142,7 @@ static void fill_pool(void) * READ_ONCE()s pair with the WRITE_ONCE()s in pool_lock critical * sections. */ - while (READ_ONCE(obj_nr_tofree) && - READ_ONCE(obj_pool_free) < debug_objects_pool_min_level) { + if (READ_ONCE(obj_nr_tofree)) { raw_spin_lock_irqsave(&pool_lock, flags); /* * Recheck with the lock held as the worker thread might have --=20 2.34.1 From nobody Fri Dec 19 10:41:38 2025 Received: from szxga07-in.huawei.com (szxga07-in.huawei.com [45.249.212.35]) (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 78C6D21018F for ; Mon, 2 Sep 2024 14:09:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.35 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725286187; cv=none; b=cGWlDI0SkhSATaRHLMO+QJ7JFeErCwunu+tbPs9aKklzK8z1MxbUWynPKSPmSNCYYCwOWMBwG85AUfQlgUpqXfUMKkbT+FSPlXEO9I9GaeQLVWGdQzULK7h+tNWL9MvZTvmdb/LKe4KyhxjiTYsymxPtVenu32Jpwlba2+craRM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725286187; c=relaxed/simple; bh=L8pJ9sYAixGyyDr7T0fwgN2WWBSMszASMnDXD2rpsWU=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qBvmJ9srz2iAjl3kElGgkORz6PZjkgCy3YxdQx7AkIJsKj96Em6f4Vp/9Jq93kuqUpN9U2NI6g1hjR6t911BSqEyMocrtkJr5bt6CJqpbTT/eoE2z2oUX9ptINJOlNGaXDClobdUSxeXxosVAvYyR+6zhqPAqZR0xT5iqd4hoYc= 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; arc=none smtp.client-ip=45.249.212.35 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 Received: from mail.maildlp.com (unknown [172.19.163.17]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4Wy9c40sMxz1S9NK; Mon, 2 Sep 2024 22:09:24 +0800 (CST) Received: from dggpemf100006.china.huawei.com (unknown [7.185.36.228]) by mail.maildlp.com (Postfix) with ESMTPS id A49721A0188; Mon, 2 Sep 2024 22:09:42 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemf100006.china.huawei.com (7.185.36.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 2 Sep 2024 22:09:42 +0800 From: Zhen Lei To: Andrew Morton , Thomas Gleixner , CC: Zhen Lei Subject: [PATCH 3/5] debugobjects: Don't start fill if there are remaining nodes locally Date: Mon, 2 Sep 2024 22:05:30 +0800 Message-ID: <20240902140532.2028-4-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.37.3.windows.1 In-Reply-To: <20240902140532.2028-1-thunder.leizhen@huawei.com> References: <20240902140532.2028-1-thunder.leizhen@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: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemf100006.china.huawei.com (7.185.36.228) Content-Type: text/plain; charset="utf-8" If the conditions for starting fill are met, it means that all cores that call fill() later are blocked until the first core completes the fill operation. But obviously, for a core that has free nodes locally, it does not need to be blocked. This is good in stress situations. Signed-off-by: Zhen Lei --- lib/debugobjects.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/debugobjects.c b/lib/debugobjects.c index aba3e62a4315f51..fc8224f9f0eda8f 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -130,10 +130,15 @@ static void fill_pool(void) gfp_t gfp =3D __GFP_HIGH | __GFP_NOWARN; struct debug_obj *obj; unsigned long flags; + struct debug_percpu_free *percpu_pool; =20 if (likely(READ_ONCE(obj_pool_free) >=3D debug_objects_pool_min_level)) return; =20 + percpu_pool =3D this_cpu_ptr(&percpu_obj_pool); + if (likely(obj_cache) && percpu_pool->obj_free > 0) + return; + /* * Reuse objs from the global free list; they will be reinitialized * when allocating. --=20 2.34.1 From nobody Fri Dec 19 10:41:38 2025 Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) (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 A0C6721019C for ; Mon, 2 Sep 2024 14:09:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.191 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725286187; cv=none; b=XhuoLCriSGmrLqhaytGVjxz1au889qIoIE50THJGpdtJ4cH49AsJmNpNwTvZx73y+1pMzPrRJ+gg5BOO0p59SgtcG1g9fLSY4BNjc4TVLe+JJb+ZCOv97LTRK+CtkY9mj7LSt1Il6EvPfduvWHicFI3KCD1fa76gMjWmhtXiNuA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725286187; c=relaxed/simple; bh=q2fKjLrs2NiGAyevC46WOaaOqsgpMOMmZb36Y7TisgY=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=o9T971H5yFIRbyMW0LTJVZBq0dES5u/SF+aAKr107LaZvoC7Zg8ziBDQLJydeEgGOH0ZhHnqhEPi73zptqmAQVLuqPyT7o3CqD8SKLwN7csm8ORJSlSsm13fi7Sv/pe0iG/4xPRKlM30w2JGQqtBMkiIofo5v2XG1XLVWbRvNxw= 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; arc=none smtp.client-ip=45.249.212.191 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 Received: from mail.maildlp.com (unknown [172.19.88.163]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4Wy9XT4Zmzz1HJ5x; Mon, 2 Sep 2024 22:06:17 +0800 (CST) Received: from dggpemf100006.china.huawei.com (unknown [7.185.36.228]) by mail.maildlp.com (Postfix) with ESMTPS id 17F3518001B; Mon, 2 Sep 2024 22:09:43 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemf100006.china.huawei.com (7.185.36.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 2 Sep 2024 22:09:42 +0800 From: Zhen Lei To: Andrew Morton , Thomas Gleixner , CC: Zhen Lei Subject: [PATCH 4/5] debugobjects: Use hlist_splice_init() to reduce lock conflicts Date: Mon, 2 Sep 2024 22:05:31 +0800 Message-ID: <20240902140532.2028-5-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.37.3.windows.1 In-Reply-To: <20240902140532.2028-1-thunder.leizhen@huawei.com> References: <20240902140532.2028-1-thunder.leizhen@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: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemf100006.china.huawei.com (7.185.36.228) Content-Type: text/plain; charset="utf-8" The sub list can be prepared in advance outside the lock, so that the operation time inside the lock can be reduced and the possibility of lock conflict can be reduced. Signed-off-by: Zhen Lei --- lib/debugobjects.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/lib/debugobjects.c b/lib/debugobjects.c index fc8224f9f0eda8f..998724e9dee526b 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -167,23 +167,25 @@ static void fill_pool(void) return; =20 while (READ_ONCE(obj_pool_free) < debug_objects_pool_min_level) { - struct debug_obj *new[ODEBUG_BATCH_SIZE]; + HLIST_HEAD(batch_list); + struct debug_obj *new, *last; int cnt; =20 for (cnt =3D 0; cnt < ODEBUG_BATCH_SIZE; cnt++) { - new[cnt] =3D kmem_cache_zalloc(obj_cache, gfp); - if (!new[cnt]) + new =3D kmem_cache_zalloc(obj_cache, gfp); + if (!new) break; + hlist_add_head(&new->node, &batch_list); + if (cnt =3D=3D 0) + last =3D new; } if (!cnt) return; =20 raw_spin_lock_irqsave(&pool_lock, flags); - while (cnt) { - hlist_add_head(&new[--cnt]->node, &obj_pool); - debug_objects_allocated++; - WRITE_ONCE(obj_pool_free, obj_pool_free + 1); - } + hlist_splice_init(&batch_list, &last->node, &obj_pool); + debug_objects_allocated +=3D cnt; + WRITE_ONCE(obj_pool_free, obj_pool_free + cnt); raw_spin_unlock_irqrestore(&pool_lock, flags); } } --=20 2.34.1 From nobody Fri Dec 19 10:41:38 2025 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) (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 419C3183CDC for ; Mon, 2 Sep 2024 14:09:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.188 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725286188; cv=none; b=WAv586DYKQ1uKEtdU5Asgr9W/Mva9yrzE+z71hpgGwoCCJgQOVEZfMigdasGt2krTkUw38mtG3THorcUh/qpgzPTLW8ftJaVLHPHMGHmcjPuVC0SF6nvPBhp99hoK/i6nFu5Lj9hGuweA+eOVYpGxFRsxvM8Sg7yZtO66kMa0Wk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725286188; c=relaxed/simple; bh=wRFqaBMJzjtMKwr/05ElStcIe5hf+gW4WrjXMBA5jHc=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=U3SafJWdLQxFaOVgJahy4u8BR20X/WCOi91TwMqBeEHaTyKY1NAYgxW0qncTu9ouqgtGTdqW6xVrzT4RhoTjXqMuPezY+N9RLx3A+/FhCBo9wBluRasz83xdUnCpg4LCVFeAsz+00YKwXkicxTo3p8yfY3Oms6vyY6W8QIZ7qV8= 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; arc=none smtp.client-ip=45.249.212.188 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 Received: from mail.maildlp.com (unknown [172.19.163.174]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Wy9ZK4g7lzpV2n; Mon, 2 Sep 2024 22:07:53 +0800 (CST) Received: from dggpemf100006.china.huawei.com (unknown [7.185.36.228]) by mail.maildlp.com (Postfix) with ESMTPS id 7B735140121; Mon, 2 Sep 2024 22:09:43 +0800 (CST) Received: from thunder-town.china.huawei.com (10.174.178.55) by dggpemf100006.china.huawei.com (7.185.36.228) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Mon, 2 Sep 2024 22:09:43 +0800 From: Zhen Lei To: Andrew Morton , Thomas Gleixner , CC: Zhen Lei Subject: [PATCH 5/5] debugobjects: Delete a piece of redundant code Date: Mon, 2 Sep 2024 22:05:32 +0800 Message-ID: <20240902140532.2028-6-thunder.leizhen@huawei.com> X-Mailer: git-send-email 2.37.3.windows.1 In-Reply-To: <20240902140532.2028-1-thunder.leizhen@huawei.com> References: <20240902140532.2028-1-thunder.leizhen@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: dggems703-chm.china.huawei.com (10.3.19.180) To dggpemf100006.china.huawei.com (7.185.36.228) Content-Type: text/plain; charset="utf-8" The statically allocated objects are all located in obj_static_pool[], no one will use them anymore, the whole memory of obj_static_pool[] will be reclaimed later. Therefore, there is no need to split the remaining statically nodes in list obj_pool into isolated ones. Just write INIT_HLIST_HEAD(&obj_pool) is enough. Since hlist_move_list() directly discards the old list, even this can be omitted. Signed-off-by: Zhen Lei --- lib/debugobjects.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/lib/debugobjects.c b/lib/debugobjects.c index 998724e9dee526b..d3845705db955fa 100644 --- a/lib/debugobjects.c +++ b/lib/debugobjects.c @@ -1333,10 +1333,7 @@ static int __init debug_objects_replace_static_objec= ts(void) * active object references. */ =20 - /* Remove the statically allocated objects from the pool */ - hlist_for_each_entry_safe(obj, tmp, &obj_pool, node) - hlist_del(&obj->node); - /* Move the allocated objects to the pool */ + /* Replace the statically allocated objects list with the allocated objec= ts list */ hlist_move_list(&objects, &obj_pool); =20 /* Replace the active object references */ --=20 2.34.1