From nobody Thu Dec 18 20:20:42 2025 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (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 824941990D6 for ; Wed, 18 Dec 2024 11:16:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734520589; cv=none; b=j2OcEOEH27hZREVyjU6BVsaJifJy4wnbxkdudvR8sAoqoiYd87okDqH9lBU/NvolsEKzgMp/QA2Jy/cNRpsfkEkQ5tGrSgsoSnLcHlclHq4gp7lyH7/wayiAbLHz0CVRN3f8zZlV7Qh+hj6rxCOF59neDwkr+dcpq04u6kVFz6E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734520589; c=relaxed/simple; bh=InvQp8csFucSAYHvhD3g6l+nVFgce1XtjBnaPhEq20I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qlj3zldp//0n9pQWdX0N0V6M1IJgdcIR24bV+uss6E6L2Ud03vqcvH63ssEQxfm4wq2DGU2UYgsq4MtXdxaLE1L1D4K3Y3H2BabcTnmn7EntOLDDy7JUPgaxryr8pCGKZkWZbAHNNg6b2WmaHJwGIqkOtpufoY+0g9EzjxsX7A8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=TADJ2fNN; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=yuo/oj78; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="TADJ2fNN"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="yuo/oj78" From: Sebastian Andrzej Siewior DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1734520585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gQw1ajNgbVfr/Cy7eKebvTHzkVUlLunUhj0hFbpNeGU=; b=TADJ2fNN4+8V4eGcE3LEw8PjJf84dNmIruJUZTWtfbxj57ul3lzqCabze3sNHhcUKrIkjF H10UrQihUyWr0dUe1qw6zvgI6pd/I0bm1BseHB6ASHF9YYUjGiA9rQKcx9ogreYYHrVefS Ryo1H3ib7NEVV6J53JR9ZbS6/9JvfP8G8fv87AD7OALhZCoOvPLShxNJu9qcb/mz3LZ7SR Rk6r3J14QvonH2elspnT/nD75N4fn8JB12NNnl3xRuei13yhpcNrk9zjoKHIfFfcetqzYk jc0NEWqDVPTY24KJugBXZVRZNIsmZ7PBUfYagqe3Ux1dARfoyXTdPAM4FiMz8g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1734520585; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gQw1ajNgbVfr/Cy7eKebvTHzkVUlLunUhj0hFbpNeGU=; b=yuo/oj78SjNviLgfkUcNjhGLIIZf/iw+4DPvgfZJRodOxNaKb5an5Hmidudc5Q/xKwt9OW x9AKmmlzxanzRSBg== To: linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Almeida?= , Darren Hart , Davidlohr Bueso , Ingo Molnar , Juri Lelli , Peter Zijlstra , Thomas Gleixner , Valentin Schneider , Waiman Long , Sebastian Andrzej Siewior Subject: [PATCH v6 01/15] futex: Create helper function to initialize a hash slot. Date: Wed, 18 Dec 2024 12:09:39 +0100 Message-ID: <20241218111618.268028-2-bigeasy@linutronix.de> In-Reply-To: <20241218111618.268028-1-bigeasy@linutronix.de> References: <20241218111618.268028-1-bigeasy@linutronix.de> 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" Factor out the futex_hash_bucket initialisation into a helpr function. The helper function will be used in a follow up patch implementing process private hash buckets. Signed-off-by: Sebastian Andrzej Siewior --- kernel/futex/core.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/kernel/futex/core.c b/kernel/futex/core.c index ebdd76b4ecbba..d1d3c7b358b23 100644 --- a/kernel/futex/core.c +++ b/kernel/futex/core.c @@ -1124,6 +1124,13 @@ void futex_exit_release(struct task_struct *tsk) futex_cleanup_end(tsk, FUTEX_STATE_DEAD); } =20 +static void futex_hash_bucket_init(struct futex_hash_bucket *fhb) +{ + atomic_set(&fhb->waiters, 0); + plist_head_init(&fhb->chain); + spin_lock_init(&fhb->lock); +} + static int __init futex_init(void) { unsigned int futex_shift; @@ -1141,11 +1148,8 @@ static int __init futex_init(void) futex_hashsize, futex_hashsize); futex_hashsize =3D 1UL << futex_shift; =20 - for (i =3D 0; i < futex_hashsize; i++) { - atomic_set(&futex_queues[i].waiters, 0); - plist_head_init(&futex_queues[i].chain); - spin_lock_init(&futex_queues[i].lock); - } + for (i =3D 0; i < futex_hashsize; i++) + futex_hash_bucket_init(&futex_queues[i]); =20 return 0; } --=20 2.45.2