From patchwork Fri Jun 21 10:27:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Andrzej Siewior X-Patchwork-Id: 13707243 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 2389CC27C4F for ; Fri, 21 Jun 2024 10:27:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 729806B0304; Fri, 21 Jun 2024 06:27:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 63BC36B0301; Fri, 21 Jun 2024 06:27:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 440166B02FB; Fri, 21 Jun 2024 06:27:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 270796B02E8 for ; Fri, 21 Jun 2024 06:27:57 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 99825120CBD for ; Fri, 21 Jun 2024 10:27:56 +0000 (UTC) X-FDA: 82254520152.25.0DBCAC3 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by imf11.hostedemail.com (Postfix) with ESMTP id D9E1E40011 for ; Fri, 21 Jun 2024 10:27:54 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=kiuAqeFq; dkim=pass header.d=linutronix.de header.s=2020e header.b=jK2ruPAm; spf=pass (imf11.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=1718965665; 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:in-reply-to: references:dkim-signature; bh=GgFSOzfsu/oBizQdGAbP6Dy2S2N7Pd0FwWEKVSEsrsQ=; b=VOdjyzVnjY6nPcv4ocAv5DopJBgTo5eGKZNR0hVuyIZ7hqURrudupMLP9XiM3nUozNazIV bVV5JkVIe7SWve33s4VJn7uGLuZc32QdI5TRPeZJmkVz5g9sZjxGOOqbTGNzzFxNcLbFHh GDdrDYkhdGHt309rpv7IGSmfws/hZ/A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718965665; a=rsa-sha256; cv=none; b=jcjz83g9YXElR+8DSwcfZzgTQH9lZIlqcOTWFN20TMZu/Z7fEonrPvrsxk4cHV6gDTsQSP cdkis54yfs+pM31ocij9zGat49O8R3tLLzwAdRi8+2ybdylscOGkYBO5+8wPNU1YnrX1I+ EXkFITo5pK6oofenY0BHneGbEXKh1wU= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linutronix.de header.s=2020 header.b=kiuAqeFq; dkim=pass header.d=linutronix.de header.s=2020e header.b=jK2ruPAm; spf=pass (imf11.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 Date: Fri, 21 Jun 2024 12:27:50 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1718965672; 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; bh=GgFSOzfsu/oBizQdGAbP6Dy2S2N7Pd0FwWEKVSEsrsQ=; b=kiuAqeFqnVJkBKu40mK6tIUM6NCMZC4C3AQwjOiqe/0QDo5TuNLXXOycbvrzD0k81eQA7k oIjDFVfvvWBgt2qv7HaVNj/HlzhN+87VyNHWaJq4Il9YI35yAWEzE+MVree6KaYwKSSZC3 dt4bj3SI3K/KzB0ypapRrYouWi886KR7aVcA4Y3ahBp2vX25WD8RuzTzg68dB6HWKvVLWx BjXab08+F2GgXYhgwOX7d1bMHGQZvhXfGGSfMznxtqNQa4XJFIxIhr012sYtfRqfvYvzub vVnPcPb8jurKiQGHMJ5I61gXSy9LzNGC4LozfU69NxOEM87CkStgbLMzTGYMIA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1718965672; 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; bh=GgFSOzfsu/oBizQdGAbP6Dy2S2N7Pd0FwWEKVSEsrsQ=; b=jK2ruPAmQp3Fhf5lYRhPcjgSA7PZzms4ODCtS9adgzLwQYyf5w44IngHNKHdLI4jnusPYI o4OXusk195bkC/BA== From: Sebastian Andrzej Siewior To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Andrew Morton , Ben Segall , Daniel Bristot de Oliveira , Dietmar Eggemann , Ingo Molnar , Juri Lelli , Kent Overstreet , Klara Modin , Mel Gorman , Peter Zijlstra , Steven Rostedt , Suren Baghdasaryan , Thomas Gleixner , Valentin Schneider , Vincent Guittot Subject: [PATCH] sched/task_struct: Move alloc_tag to the end of the struct. Message-ID: <20240621102750.oH9p1FQq@linutronix.de> MIME-Version: 1.0 Content-Disposition: inline X-Rspamd-Queue-Id: D9E1E40011 X-Stat-Signature: mqpwman8eko6b1zomxwpas6gmgorf4b4 X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1718965674-202565 X-HE-Meta: U2FsdGVkX1+tEK7L5x9DBy0jUjqjW1NJ71vGzSPDZFWOZEquIe0/tA4Vm0Aw/PRFwPDUMgPKsiAD9jc3SHU5Zjn1mPTFRRzJUkCgiKibd2umf+IgeqqwJjR3elby8D5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.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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 padding after `on_cpu'. A few members later, `se' requires a cacheline aligned due to struct sched_avg resulting in 52 hole before `se'. This is the case on 64bit-SMP architectures. The 52 byte hole can be avoided by moving alloc_tag away where it currently resides. Move alloc_tag to the end of task_struct. There is likely a hole before `thread' due to its alignment requirement and the previous members are likely to be already pointer-aligned. Fixes: 22d407b164ff7 ("lib: add allocation tagging support for memory allocation profiling") Signed-off-by: Sebastian Andrzej Siewior --- include/linux/sched.h | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/linux/sched.h b/include/linux/sched.h index 61591ac6eab6d..d76c61510ef1d 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -770,10 +770,6 @@ struct task_struct { unsigned int flags; unsigned int ptrace; -#ifdef CONFIG_MEM_ALLOC_PROFILING - struct alloc_tag *alloc_tag; -#endif - #ifdef CONFIG_SMP int on_cpu; struct __call_single_node wake_entry; @@ -1553,6 +1549,9 @@ struct task_struct { #ifdef CONFIG_USER_EVENTS struct user_event_mm *user_event_mm; #endif +#ifdef CONFIG_MEM_ALLOC_PROFILING + struct alloc_tag *alloc_tag; +#endif /* * New fields for task_struct should be added above here, so that