From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f65.google.com (mail-wm1-f65.google.com [209.85.128.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 32B9C33E7 for ; Fri, 12 Dec 2025 13:02:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.65 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765544568; cv=none; b=it45tIJ8f+Ovsb8XJlISxT+C3NE6TrTlyWK2/4DrdzK5nJFujdc6mHIKzXtFGKlPUmxrjAohHA9WoCIB/3jSVjY6rGY+9jzoQv2jKM6x4isEtHB3fhLQY2BOVyeMXmr0lCORk//Z/xBbA8iD9a+iksz56l5VVQnBkiwuzLn166M= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765544568; c=relaxed/simple; bh=VukBsc6FGMmQQ+BO0NNfOaFs5WeHeuvwGTi+Qc1als0=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=iGT+AY0+l4548evidh7HYdAeh9o4xlYYsijlKy9VvAq8hLvkLWUW0vH9ll73tggaPO2uqJe4vwOOkPufygE1fCXyAMLCSPlu1mzJPQjd7sERJvPvMqxHOkGrYWRFvl5DBdaBAAC8jc70cung6jiTe6BoDEXw5bZYxp09wYthePA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ebYde7hB; arc=none smtp.client-ip=209.85.128.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ebYde7hB" Received: by mail-wm1-f65.google.com with SMTP id 5b1f17b1804b1-477b5e0323bso5311585e9.0 for ; Fri, 12 Dec 2025 05:02:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765544565; x=1766149365; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=c+rorvaCpkrXjldTveJt4G+UEEpEjCpbPUS2YfhhEgE=; b=ebYde7hBDRU5mYRb42jT8hvdHs6QykdhwCKBZPKKvzlXtBCEHnKbFKnyKlt5w8FmIE fjfOVncuRa7vLJaep+6lwIljLUvFHq72jzJ+1j0+2+k14y+5WxDiEGtuWh/yPgYGgmEx AVfVShutzYkctZuzHp87nhwvfNTeA0/x77fTxXLnbMxwS1kJWfIgKQyxwh+aIt6C/2hJ XQkc1p+m70KP7UkhINNoZWE5+ub+nLLTQxx8Dw6sVgsC8KedTUEORKGhYzoweUKf4dah 5hdIGtzcZb48HNzttLbyHOUKXcd3Snyg23XVijBUoMJwIC6qWi/BtZCGv9N8G43+zZVi NBBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765544565; x=1766149365; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=c+rorvaCpkrXjldTveJt4G+UEEpEjCpbPUS2YfhhEgE=; b=F5RCLNedifcO6PWtYACkjZLAsZhqVHVyDm24hCH3SpR4MrrjpJgeYXUkE277FQiNY1 4NrxGkmLutLrBnsLPvk+5qvIitN4+L5iTL22P/d60tXiwxzQv5zOWCg13Y6Bt4uKmLpL 1BmnT70WdbGs2CGmuxtqwnYIqrKJX9Qf66VelKSKv2cXXZPnv/x8vpAI/e5Km/jDLe/i SSm/keSNOKvmNuRf+6/c4wABw5D0I3RnLnJXxTLUcJ5jjZLHKK1tNqm1nswgKriFJ3Dz fQ3xDpDu70C+zwu8jfbBjzcD8umu5Y7si/CjYEgNerTan5XjDghWSf/GqEZOacAh31Lt YGqg== X-Forwarded-Encrypted: i=1; AJvYcCUf0MOhEmO5dQL71F7JXJCVknyRq9kzFwwL1c0rDtD3Hbc7mQWlnIVLNFpk+BRDnANN201YnVzUuGEVwlE=@vger.kernel.org X-Gm-Message-State: AOJu0YxLeGllUDDOufrmFFkG3hJhfYdOEjm7ApnglG0UeGJHF6pPvGN+ oi5zHQv0JQDhr69oB+P2HTxLdQBGFBYUoiZigq4z4GE7Rugk0GQuhEFp X-Gm-Gg: AY/fxX57LZfuPSYGSWuBcCBiJOvxYEAXM/RLW2U9njPXhAswJEhXOyTgkulsVn28wls FnOdB8336n9qsvLoTMwXW/NzWsY6hyzTHVI/41spJy2bH0bTzfwnumktWr/6KxAqhoBjGpbcqRc IervGncZ1yHMPCIQwxjSpyFUL3LboQ1QEdg/JX7dKVxRGQZaeS8M/23JWPFCrtGoUDayEwgyX5D sjWW3iyFp1mGayP6afZJ0svURaf8Sm5DwLCSUJ24B2/YtpyyLSsMKAPM7HcPxfEFUzvyuQiBcW8 B8M7meXWPvlZFKcXajt92b/O1rrnWBigbzhoPB9aqRy5uy6o/BxCT2rrX4lvTf/q7kRC5SfwIVq qTjw65z2K8ItkEFEkS/XrZMOR/6urekG9UON+h67YBnOaBAMJSOb91MLQ06qYyT3aFuYN0Ui+lz VBbrGmmWu2aQXIp/Hyb3UnRgV2rkFsXqDPgnAMrAt9lStLMu3/jYX1us8XmadklLE= X-Google-Smtp-Source: AGHT+IGPkpidwmTBkjM2H92tIpLg2lbV7W/zkC+iA9hYvJ7UaBJBAEgFvqpcFgTWUMsdXPM9OkkCIQ== X-Received: by 2002:a05:600c:4e91:b0:475:ddad:c3a9 with SMTP id 5b1f17b1804b1-47a8f2c2f62mr21854405e9.13.1765544565230; Fri, 12 Dec 2025 05:02:45 -0800 (PST) Received: from pumpkin (82-69-66-36.dsl.in-addr.zen.co.uk. [82.69.66.36]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47a8f70509bsm11976135e9.6.2025.12.12.05.02.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Dec 2025 05:02:44 -0800 (PST) Date: Fri, 12 Dec 2025 13:02:43 +0000 From: David Laight To: Mateusz Guzik Cc: Vlastimil Babka , Lorenzo Stoakes , Andrew Morton , David Hildenbrand , "Liam R . Howlett" , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , oliver.sang@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: avoid use of BIT() macro for initialising VMA flags Message-ID: <20251212130243.03538bc3@pumpkin> In-Reply-To: References: <20251205175037.1287366-1-lorenzo.stoakes@oracle.com> <20251205184342.2cfcc73e@pumpkin> <4eea9138-3853-457d-9113-e3caa7f00437@lucifer.local> <20251205213449.12bf4819@pumpkin> <7006fa60-f4d3-4e7d-8c2b-974e9e4a1224@suse.cz> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Fri, 12 Dec 2025 13:24:57 +0100 Mateusz Guzik wrote: > So I had a look where the timing difference is coming from and I think > I have the answer: init_ipc_ns does not have a guaranteed cacheline > placement and things get moved around with the patch. > > On my kernels (nm vmlinux-newbits | sort -nk 1 | less) > > before: > ffffffff839ffb60 T init_ipc_ns > ffffffff83a00020 t event_exit__msgrcv > > after: > ffffffff839ffbc0 T init_ipc_ns > ffffffff83a00080 t event_exit__msgrcv > > This is the pervasive problem of vars from all .o files placed > adjacent to each other, meaning changes in one .o file result in > offsets changing in other files and then you get performance > fluctuations as not-explicitly-padded variables share (or no longer > share) cachelines. Those look like text symbols, not data ones. But moving code about can make the same sort of changes. > I brought this up a year ago elsewhere: > https://gcc.gnu.org/pipermail/gcc/2024-October/245004.html My guess is that all the extra padding increases the cache footprint of the code and that causes other cache lines to displaced and then needing to be re-read from memory. So while a specific benchmark may improve, overall system performance goes down. Excessive loop unrolling has the same effect. David > > maybe i should pick it up again and see it through > > as for the thing at hand, someone(tm) will want to make sure the > namespace is cacheline aligned and possibly pad its own internals > afterwards. Personally I can't be bothered.