From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 BD02E1D1E95; Wed, 2 Oct 2024 14:20:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727878855; cv=none; b=aukRXYuYXC0sKhOyZxNjV+h68A2UBM3ui5PLwwCYwoWrALGO5Z5SRisVXAbyBkY7k+vhWOuCfZvDX5OdomnF/2SI6zgbV06lmEC8JcEzLJ1xVHrmoYxBiLsQQfifKJO2tzeSTDqW2YAOEodN1dTZbl1gLUTuXs0tiTXY/qAUzBU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727878855; c=relaxed/simple; bh=MoBci3c1R8cPfzVohoy5X4EJKdAl9bFYPtyfMuaqWZI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fyp6yjSgrt6xlUTMBejS7+wjJEjxDJqDvIa0V7sRTpNk6LbjAVumYafOzRfBKs3YsKkYozuJAPmbHlkVAbw7dLSEEBznXYEQVJWuwFKIkhFKVsoKEdC2VAdMpWxJRWcDPzu8FHsSkEIfyDIfWtZM2vKcAEfttubK7CpYEJhJ87Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=PqUGpOlT; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="PqUGpOlT" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 44FDEC4CEC5; Wed, 2 Oct 2024 14:20:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1727878855; bh=MoBci3c1R8cPfzVohoy5X4EJKdAl9bFYPtyfMuaqWZI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PqUGpOlTNzl3dIxz8DHASSBYIEDFKJHwQfYapAv8IwwYZO1XYLebZ8bbHPWQMhk3C 8nRUT86f9Vl/Se3qpXnDDspJyGyJiFo2ocTqRV1p2WCgt0VZXbA974+bZfhIgQXyw6 vrMAjv6N+Jw/2j4VbFL+mLiQCMMM8qiazpFdDGl4= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Zhen Lei , Thomas Gleixner Subject: [PATCH 6.10 556/634] debugobjects: Fix conditions in fill_pool() Date: Wed, 2 Oct 2024 15:00:56 +0200 Message-ID: <20241002125833.057187092@linuxfoundation.org> X-Mailer: git-send-email 2.46.2 In-Reply-To: <20241002125811.070689334@linuxfoundation.org> References: <20241002125811.070689334@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Zhen Lei commit 684d28feb8546d1e9597aa363c3bfcf52fe250b7 upstream. fill_pool() uses 'obj_pool_min_free' to decide whether objects should be handed back to the kmem cache. But 'obj_pool_min_free' records the lowest historical value of the number of objects in the object pool and not the minimum number of objects which should be kept in the pool. Use 'debug_objects_pool_min_level' instead, which holds the minimum number which was scaled to the number of CPUs at boot time. [ tglx: Massage change log ] 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 Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lore.kernel.org/all/20240904133944.2124-3-thunder.leizhen@huawei.com Signed-off-by: Greg Kroah-Hartman --- lib/debugobjects.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- 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_min_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 = hlist_entry(obj_to_free.first, typeof(*obj), node); hlist_del(&obj->node); WRITE_ONCE(obj_nr_tofree, obj_nr_tofree - 1);