From nobody Sat Feb 7 07:10:34 2026 Received: from mail-pf1-f196.google.com (mail-pf1-f196.google.com [209.85.210.196]) (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 B1BA3367F33 for ; Mon, 2 Feb 2026 13:28:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.196 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770038936; cv=none; b=Nm3CuJEJPz998XiXQjrA97hEHfFFmsiNtRBddnYiFOqNbKgyxUZOkGzEJWssFtIGey3pwg16SuOhl+NfjgKFpjmUoip5gN9Z9fU1QIZgjE+EmUBMv3H5epCUEqYrmfs9ccELL7590yKwGVWfKTLpzS82hr07vchvSS2sQP/OQiE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1770038936; c=relaxed/simple; bh=GuJEaCsr0FAfmQ7oHn62IKqafWOuroazxwIcBOcxR3k=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=EAnjQdSewyWD4MwOAaQnXECW457O9t42TvlPmap7khASnA95MwbhwEO+wt20s3315IF8Gdn7ihRvZecT743ws9fvbuqjcRC1+JGaQ+tbkFS5dyenzlulX7QYEVMguAmJwHtQxFryUs6bOeRraRQTHiWN+t1Afp8eUDyboP0tBtw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DBVmg+hd; arc=none smtp.client-ip=209.85.210.196 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DBVmg+hd" Received: by mail-pf1-f196.google.com with SMTP id d2e1a72fcca58-823075fed75so2860013b3a.1 for ; Mon, 02 Feb 2026 05:28:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1770038935; x=1770643735; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=zPpSpOJXyhtDrj3vTIh8uxXlNsB4mJi35n3NBfFtwuo=; b=DBVmg+hdm+15sLy4PUGG9piNuXxVYiWhKdX6TobQB4oBCaVrFdsjZcxxwRkLef0g+t vmKjnci9GC9t/XfamNeqEIX/ezEG5Ac9RmPE1cZoFM7ZDXktymdOaD39vpM/Oi+LLYOS x3TWWVL8VxTNFaJKhHKdiR1dg7g7GEcfP3q4WoD7DhcKxpK91Y7Zt1vTi0sfBfZ5DZQy q461ZkRu9p6MmXf3znWePu2Ux1Lg4lBgmEPHs/muGR7rRs0fzf48i4XdDxgX64x52bG7 0KLykK4DJeXJVxeZSX4zjxXvlXbSD9jix1JNywhclIZ3ahcfgdUanGpy4S8C23vmeG7p 3aXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1770038935; x=1770643735; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=zPpSpOJXyhtDrj3vTIh8uxXlNsB4mJi35n3NBfFtwuo=; b=C5Dbs1ywafRL9ydviwV7U9yS5s1OSNbD7+t1ZDfYGIgE6rvmTqgiI00V7T9X69/rLF HR3WD4kvgaQJk1tyU+WUqZd6Ly4gvuudtrkiEns+CfbKkpZ7dDkWznP5kJ65AIcwFYsU hDQ8HsSG2OzvsElp8qXP+3EeSxtneOP8NEmu31dWQIxBbZy7jWPJb+XpPnEYDJJdiXOi jVOEbUGTTmCNXsLEqXRfX3lthbt5Owf6DMuGk42TJlR/3H0WydTfUh5DpNSvSnsXxsRB 4NVCRoJ9CALsGMdnj/4NruH7SKQLVrNciVxhdZTaV+Ut7xzIGazsf8eilE3N8d+iBdVE p5fQ== X-Forwarded-Encrypted: i=1; AJvYcCXLcehORb5uLPGpslrqRxvJ7KhFtUQ9kuO3ureVwEmOQqSsNmcEmawro/85Qk325dLLHX8oQ0AYjlXd2SM=@vger.kernel.org X-Gm-Message-State: AOJu0YwE5zXFq3YiGFYDkODHdYTTfrshRsqOb40LyX3rsM7QnVAS98Gv dnSjzj0a99dGjI9E40DCgI1R5EE2HtUjZUL/VKVVDOI/dpVm9LP7mZ1i X-Gm-Gg: AZuq6aLJITsaJY88HbKU8FEy1IYBgu4H+RQq96smoIsQX5ymsstCU5gTgYnX+BIWdY3 aRhTA24NFSN9r8REMb4Vszt083nDyhmupGIHc5lPvbnf1mdnm4rSl0wtjkb70ImAbREs7V5uQvM O3HOxV+KWuV5SCsawbCpm5Cdnq0oo42gNx5maWsaA57GeDKZSwrX/2lJYQEzCR/bQDNQu3Nyxe6 dRfc5qnJBDfInidEbQZUUHnA0UqSoeuSASwOsenhV3c9H89Bm4k/Ocw0XYsLtfCnzMzOLwnxqcz 2sCNMZdqxhM4CplZQcFR9rzsH1JMQW72rgwU+KSZE9w6PU7Qg8842HYzq4YeWWQS87T0l6sAojv s6JXtpZao7B8dvWwXFWt62VN+iiMFmlpcfD3NHVCuO474b2MHt+i/AGDlHKrxMRxEfVMsn4aAds qkaEI3FeyQ6pnhYCfSTEwMVHZBRBcbABPr5Q5qJH/nOZ8AhKAikL8CJjT/JyMEfQ== X-Received: by 2002:a05:6a00:1490:b0:81c:717b:9d31 with SMTP id d2e1a72fcca58-823ab641914mr9089893b3a.2.1770038935041; Mon, 02 Feb 2026 05:28:55 -0800 (PST) Received: from zhouwh-HP-ProDesk-680-G6-PCI-Microtower-PC.mioffice.cn ([2408:8607:1b00:7:b624:e8db:f5a2:797c]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82379bfb924sm16540190b3a.34.2026.02.02.05.28.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Feb 2026 05:28:54 -0800 (PST) From: zhouwenhao To: wuqiang.matt@bytedance.com, akpm@linux-foundation.org Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org, zhouwenhao Subject: [PATCH] objpool: fix the overestimation of object pooling metadata size Date: Mon, 2 Feb 2026 21:28:46 +0800 Message-Id: <20260202132846.68257-1-zhouwenhao7600@gmail.com> X-Mailer: git-send-email 2.25.1 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 Content-Type: text/plain; charset="utf-8" objpool uses struct objpool_head to store metadata information, and its cpu_slots member points to an array of pointers that store the addresses of the percpu ring arrays. However, the memory size allocated during the initialization of cpu_slots is nr_cpu_ids * sizeof(struct objpool_slot). On a 64-bit machine, the size of struct objpool_slot is 16 bytes, which is twice the size of the actual pointer required, and the extra memory is never be used, resulting in a waste of memory. Therefore, the memory size required for cpu_slots needs to be corrected. Fixes: b4edb8d2d464 ("lib: objpool added: ring-array based lockless MPMC") Signed-off-by: zhouwenhao --- lib/objpool.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/objpool.c b/lib/objpool.c index b998b720c732..d98fadf1de16 100644 --- a/lib/objpool.c +++ b/lib/objpool.c @@ -142,7 +142,7 @@ int objpool_init(struct objpool_head *pool, int nr_objs= , int object_size, pool->gfp =3D gfp & ~__GFP_ZERO; pool->context =3D context; pool->release =3D release; - slot_size =3D nr_cpu_ids * sizeof(struct objpool_slot); + slot_size =3D nr_cpu_ids * sizeof(struct objpool_slot *); pool->cpu_slots =3D kzalloc(slot_size, pool->gfp); if (!pool->cpu_slots) return -ENOMEM; --=20 2.25.1