From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id C0687C2BB85 for ; Fri, 21 Jun 2024 19:07:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4ED708D0194; Fri, 21 Jun 2024 15:07:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3B5648D0190; Fri, 21 Jun 2024 15:07:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B6BD8D0194; Fri, 21 Jun 2024 15:07:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id E8AF58D0190 for ; Fri, 21 Jun 2024 15:07:25 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 65A8AC0E3D for ; Fri, 21 Jun 2024 19:07:25 +0000 (UTC) X-FDA: 82255829250.08.3FA6EBE Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf23.hostedemail.com (Postfix) with ESMTP id 6E48D14001D for ; Fri, 21 Jun 2024 19:07:23 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=wwkrM4GI; dkim=pass header.d=linutronix.de header.s=2020e header.b=JEVCOytz; spf=pass (imf23.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718996838; a=rsa-sha256; cv=none; b=kEFuZtjxDn3/sBaAQezsRWkfRRAng2NbPSuZV8O0wPbUfUEdjS5rtDSvvBPMbneBIds433 2tVV1smEQBlUUpQFZfxdtgm/CHXTcneS4aHjdh+fl8b51+Ed1fQ7Rlz7+dtum9YO8e92uw 8YExA08RM0ic5YsuGsFPQd9RQEspOtU= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=wwkrM4GI; dkim=pass header.d=linutronix.de header.s=2020e header.b=JEVCOytz; spf=pass (imf23.hostedemail.com: domain of bigeasy@linutronix.de designates 193.142.43.55 as permitted sender) smtp.mailfrom=bigeasy@linutronix.de; dmarc=pass (policy=none) header.from=linutronix.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718996838; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=WpdDCLSWpeah/VuUAMtfv28UPenBu9uLrfYHAz6IAi8=; b=uGLp09r3EdJ03tzvR1Bwp8dQxlJnPVpe8/ThpVcecK0u5nk8OttE4pJph8Efv8bmfAO6Na mVYc1cTBe0ZXTURar2ZeRDlotMGXAc07ms3cFFE8waiVIjrpb6tah71AUms138p+bwnpMz qqMYeAyoI63LXRlKSQfMO45xhXcCACQ= Date: Fri, 21 Jun 2024 21:07:19 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718996841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WpdDCLSWpeah/VuUAMtfv28UPenBu9uLrfYHAz6IAi8=; b=wwkrM4GIw9Or/b6wteE5g6xVW6K9S89n/g0BIMmPs4lVMKi0XsIKoo8y5tH2K4gin77H2v VXet5JzPjpM0Ncqxk8xGyhT90f85bj3Td8MYV5kq1EOs4Y++Balf9in9Ph3nUaFEtmI9vk b5rvJzSLSM3mcMA6FyFMw+ofEA4J82WXuRZzUd44twZ+qqvuZ2veLCknVk1B9sFBRufZg4 Iq1bBE3D3MKuC67tN+aMZqpL9JZMs3Fn47a5Fb5/pR5gELf0bJWQ/LiDgu8ZAwPqKKaSEY Wp/hl8wINh8w3vI3Bt3zBp3o1e2bckRpBGaVH+wT6tK9qrPFnutFV5L+Fw+++w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718996841; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WpdDCLSWpeah/VuUAMtfv28UPenBu9uLrfYHAz6IAi8=; b=JEVCOytzpOb/hy0/DrBqCBtA7xpFAN8ePUV0tIOTSxtb6kK2HDGNeI272x6vmXbefgTLH2 xBi1dtGZBAeeo1Ag== From: Sebastian Andrzej Siewior To: Kent Overstreet Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Andrew Morton , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Ingo Molnar , Juri Lelli , Klara Modin , Mel Gorman , Peter Zijlstra , Steven Rostedt , Suren Baghdasaryan , Thomas Gleixner , Valentin Schneider , Vincent Guittot Subject: Re: [PATCH] sched/task_struct: Move alloc_tag to the end of the struct. Message-ID: <20240621190719.TeLTxI9M@linutronix.de> References: <20240621102750.oH9p1FQq@linutronix.de> <7zretxxixkpfxt6lr7x64n67ql2v2qpb7abbbjklclwlu4u2kx@22o5sdlnpkea> <20240621182915.S-ULWn0O@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable In-Reply-To: X-Stat-Signature: bcphs5zrt56j9eqgk3r7tc1gy9g5dugg X-Rspamd-Queue-Id: 6E48D14001D X-Rspam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5c75hsSsk+vAYfuJf1HjRUJnVOAqoW8YD/WHhIPApojGmJ/poPUhwYpSqaW33V5C/hgXgWz/jrcZaCHgVLrSlE2uW/Cfj1f4bOMnGwy8N86Q9vzHLL6x/yIERlIokIGT/9XgwalSr2bAiYezA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 2024-06-21 14:49:23 [-0400], Kent Overstreet wrote: > On Fri, Jun 21, 2024 at 08:29:15PM +0200, Sebastian Andrzej Siewior wrote: > > On 2024-06-21 10:20:58 [-0400], Kent Overstreet wrote: > > > On Fri, Jun 21, 2024 at 12:27:50PM +0200, Sebastian Andrzej Siewior w= rote: > > > > The alloc_tag member has been added to task_struct at the very > > > > beginning. This is a pointer and on 64bit architectures it forces 4= byte > > > > padding after `ptrace' and then forcing another another 4 byte padd= ing > > > > after `on_cpu'. A few members later, `se' requires a cacheline alig= ned > > > > due to struct sched_avg resulting in 52 hole before `se'. > > > >=20 > > > > This is the case on 64bit-SMP architectures. > > > > The 52 byte hole can be avoided by moving alloc_tag away where it > > > > currently resides. > > > >=20 > > > > Move alloc_tag to the end of task_struct. There is likely a hole be= fore > > > > `thread' due to its alignment requirement and the previous members = are > > > > likely to be already pointer-aligned. > > >=20 > > > We sure we want it at the end? we do want it on a hot cacheline > >=20 > > Well, the front is bad. > > Looking at pgalloc_tag_add() and its callers, there is no task_struct > > touching. alloc_tag_save()/restore might be the critical one. This is > > random code=E2=80=A6 Puh. So if the end is too cold, what about around = the mm > > pointer? >=20 > Not there, that's not actually that hot. It needs to be by > task_struct->flags; that's used in the same paths. But there is no space without the additional 52 bytes. Was this by any chance on purpose? Sebastian