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 4C7E1C83F22 for ; Sun, 20 Jul 2025 18:14:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A5F296B00B4; Sun, 20 Jul 2025 14:14:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A35CE6B00B5; Sun, 20 Jul 2025 14:14:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 924D26B00B6; Sun, 20 Jul 2025 14:14:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 7DF956B00B4 for ; Sun, 20 Jul 2025 14:14:55 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 2987610FC37 for ; Sun, 20 Jul 2025 18:14:55 +0000 (UTC) X-FDA: 83685444150.07.A5574B7 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf20.hostedemail.com (Postfix) with ESMTP id 773051C0005 for ; Sun, 20 Jul 2025 18:14:53 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=Q0Mjwsfk; spf=pass (imf20.hostedemail.com: domain of akpm@linux-foundation.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1753035293; 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=EyxvtvAwXjcfaj3aSpeWpV/5cOhKzis350ToWjf80d8=; b=bzzf3UTIf5F1MGZrl3NuqNpCkDCn+Waw+P3TGXGzr2Q5xJWx+LKHJFBhMkDE+GUZrlGumZ /mnkxFzNPuWyIXxaAh5GgbfvzoB2eDo+82uSuDL9ScREdm+CFgZ8Y72n/cd5TJe1me+4Mw hJ4X0HAHzCRCNj0T1qtqancATRB/cDU= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=Q0Mjwsfk; spf=pass (imf20.hostedemail.com: domain of akpm@linux-foundation.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1753035293; a=rsa-sha256; cv=none; b=DOG8adLwBMlJ2n900Hzqu6Z8n2Pu+4Wms9HO4/6HLrkzOxmG0MrkU2/iZRMPM6tGsARf71 2qI/nAi4DHVLZ7N9rUNYk7MAtHt+3jLsBZgXbOOyVwbJncOBdYVJk1ce0DZZbqTsgaGUcH pcKTQWmlaAqch0lPT3QhsUdFTBDmrxE= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 979E9A5273F; Sun, 20 Jul 2025 18:14:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 49E77C4CEE7; Sun, 20 Jul 2025 18:14:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1753035292; bh=4j59W8Itm9rcumQgArm+6vGk9dokQyPHbbeRFqauc2o=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Q0Mjwsfkt6E2H/udiafb4hIRELIOl18XM4OeiZUPgteXaOykHeNtm7DK1uheEldGN ELrloAZARvAzadG7X58rjz/6XuydQZT+9XtGMPZFkW6aXFEjeu3Tw0Tbx/xfnZUCmu Q02mwkgqtRil80TD4yjnA/ttbR8ZIaVnMm1z1JTM= Date: Sun, 20 Jul 2025 11:14:50 -0700 From: Andrew Morton To: Lorenzo Stoakes Cc: kernel test robot , Ye Liu , David Hildenbrand , Davidlohr Bueso , "Paul E. McKenney" , Josh Triplett , Frederic Weisbecker , Neeraj Upadhyay , Joel Fernandes , Boqun Feng , Uladzislau Rezki , Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , oe-kbuild-all@lists.linux.dev, Linux Memory Management List , Ye Liu , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Steven Rostedt , Mathieu Desnoyers , Lai Jiangshan , Zqiang , Dietmar Eggemann , Ben Segall , Mel Gorman , Valentin Schneider Subject: Re: [PATCH] mm: Replace (20 - PAGE_SHIFT) with common macros for pages<->MB conversion Message-Id: <20250720111450.71ce91f5354e63c975094452@linux-foundation.org> In-Reply-To: <3d459085-3b7f-4ba3-8197-832f7931bcc2@lucifer.local> References: <20250718024134.1304745-1-ye.liu@linux.dev> <202507190319.0rqhQw5l-lkp@intel.com> <87dff86f-94b8-47aa-b2e1-7560a9f60818@lucifer.local> <20250719163807.068d4cb349c6a3395183167b@linux-foundation.org> <3d459085-3b7f-4ba3-8197-832f7931bcc2@lucifer.local> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Queue-Id: 773051C0005 X-Rspamd-Server: rspam06 X-Stat-Signature: ey6ypkx5by5styje9tpiz75e3y9kf114 X-HE-Tag: 1753035293-22944 X-HE-Meta: U2FsdGVkX189dkEL7IgidCGHtw2IH4/UhiLIWecm/QASk0o7Morj51BdUBL3sSgO/e5bGIsPIV+IieobUvO/IS0oHsZ4GJWw/8mRfgbg1UrnzpsYTZUi5+sQdRc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oLmhRGp/Be3jDZyCZ3ZdxKYzoO8gVUv07xZetjQZgBWSLzecnNBuyQiakbSphvQY4MjyA7pQXcrXarbiJsE7yE9raE/IqPSNq3oi5LpXOqfeotql7YDHPOoaUe0CKMo95Ld6B9z6PkImPVW9lOanTKgNFW48+XlqQVD9K8439+gf7uOxQrDGvcY4sBxcih8ik= 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 Sun, 20 Jul 2025 09:59:55 +0100 Lorenzo Stoakes wrote: > > /* Helpers */ > > #define TO_KB(bytes) ((bytes) >> 10) > > #define TO_MB(bytes) (TO_KB(bytes) >> 10) > > #define PAGES_TO_KB(n_pages) ((n_pages) << (PAGE_SHIFT - 10)) > > #define PAGES_TO_MB(n_pages) (PAGES_TO_KB(n_pages) >> 10) > > > > are simply in the wrong place. > > > > I was thinking move all four into mm.h (for the lack of a better > > place). Then someone can make a career out of hunting down all the code > > sites which can use them. > > > > eg, > > > > hp2:/usr/src/linux-6.16-rc5> fgrep -r ">> 10" . | wc -l > > 886 > > Yeah I agree for sure, this is misplaced, but maybe one for a follow up > patch? > > There's more work to be done here, I already have an idea for a patch to > fix another similar case... OK. I could put a couple of ifndefs in there to make this patch happy, but this patch is just a little cleanup and it's a very small part of any kernel-wide overhaul of these conversion operations. So for now I think I'll retain this patch in mm-new to prevent this linux-next build error. I'll do this as a reminder until someone gets down and addresses all this in a broader fashion.