From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) (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 66D0539E17A for ; Thu, 5 Mar 2026 19:55:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=90.155.50.34 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772740554; cv=none; b=dOKnEtu4LkjwrAgnFBgOl2wXYu2Nd/rPbPJH/1H10gbrKm6iiB4gqUZ1U/LOJY6gIyCIDcq4WBOWN8mscTJGTVWI5fmmhJraiDuZDwvx/ZL/W9jqzHFmGFXos67d02I4dcrtErRy8pn7W5iDmo0pCVHVZBLjEawEa5TvkFO8mJg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772740554; c=relaxed/simple; bh=5USeT90kMCh2fG0L72ZYa64271Vvo98KJFoTHprAv6k=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=DMN6NT3UNsrZlBDOG4UL3Anp9WnbXXZSHWbZ16hIc37YX5ZPJpAE0uRbh2pSw5Ri3c4RaNA2J3m6BFNqHCawMgj+ZcesMRqn7NQ2xag8I+pmIfVhbaRaIB16P1nMkkIuw0gtCc1qGebsEqfqT8QcKeyeMPJPMKtL/pL73r0nEh0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=D1fws5e1; arc=none smtp.client-ip=90.155.50.34 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="D1fws5e1" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=6dOzYB8PomjZXuz7ouOIDt28e/J/lHKl7I36Yk/4f5E=; b=D1fws5e1ZPXbdxVbXufAZ5iVuw +1elFoA/YyYKf6tW9LduAXMkOv7Bf2kQvDoqA674MED9106XhYdDq6HGWIZDN84w+Afdmm+11nm6Y tdGLGT1d0liYSowFIGs0SJrkjGkayDudng1JBtc7tTpYhai9BF4Alf5E8IVl8fOgxik8nzMgTDNGs B9q/hBaTy4KX0C+Bcte97Qz/XgJz7XEuITYnjA2R1l01+penGXK615w5o9u+CO1CsxSAOqnFNU/57 y5zMmZeYdZzHsJKUxTTnOwRafhpH2Ym7F7ME4Nv4+Yx5GACJSVEak/Mxka84dIxu3gg41GlnvsTpl hS7+T0yA==; Received: from willy by casper.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1vyEnT-0000000FYW7-2EGj; Thu, 05 Mar 2026 19:55:47 +0000 From: "Matthew Wilcox (Oracle)" To: Peter Zijlstra Cc: "Matthew Wilcox (Oracle)" , Ingo Molnar , Will Deacon , Boqun Feng , Waiman Long , linux-kernel@vger.kernel.org Subject: [PATCH 0/3] Shrink size of sleeping locks Date: Thu, 5 Mar 2026 19:55:40 +0000 Message-ID: <20260305195545.3707590-1-willy@infradead.org> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit This series shrinks the mutex, semaphore and rw_semaphore by one pointer by changing the list_head to a pointer to the first waiter. Some sample savings with the Debian config: task_struct 5696 to 5632 bytes (89 to 88 cache lines) mm_struct 1728 to 1600 bytes (27 to 25 cache lines) mm_mm_cid 192 to 128 bytes (3 to 2 cache lines) file 184 to 176 bytes (from 22 objects per 4kB slab to 23) inode 608 to 584 bytes (from 13 objects per 8kB slab to 14) Changes from RFC: - Added patches for semaphore & mutex - Undid inadvertent change to rwsem_del_wake_waiter() - Attempted to follow Peter's preferred coding style Matthew Wilcox (Oracle) (3): rwsem: Remove the list_head from struct rw_semaphore semaphore: Remove the list_head from struct semaphore mutex: Remove the list_head from struct mutex drivers/acpi/osl.c | 2 +- include/linux/mutex.h | 2 +- include/linux/mutex_types.h | 2 +- include/linux/rwsem.h | 8 ++-- include/linux/semaphore.h | 4 +- kernel/locking/mutex-debug.c | 5 +- kernel/locking/mutex.c | 49 +++++++++++--------- kernel/locking/rwsem.c | 89 +++++++++++++++++++++++------------- kernel/locking/semaphore.c | 41 +++++++++++++---- kernel/locking/ww_mutex.h | 25 +++------- 10 files changed, 132 insertions(+), 95 deletions(-) -- 2.47.3