From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out-173.mta0.migadu.com (out-173.mta0.migadu.com [91.218.175.173]) (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 7127835A388 for ; Sun, 17 May 2026 12:34:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779021293; cv=none; b=ZrprMIGU9ei6lodnpdppU6EbSfE9uMgP3bANDQODbwl33Uf15VHB/GM/XSBfBD+5nyMv273ajn1qljtDr2qOAh6kDDQjD4VBuCAL9Zxq3ecpTC5Pj5bor/v9Z5e0UxNzMnzfJpGkDw7ebMxOD/dpWcYCITT0JGTxdEtSGUDx62I= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779021293; c=relaxed/simple; bh=MrC+0YWETyNYg6CxOeGPNoPuLtOeYreu8yN0bDb2ezY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=ZMol6TpEKykfmm4k18U/U0oqWs43aH7ZRZh/FJgP/o57nORuMR7i35sJZ0s7r9VkKxQvTAMeTko9kqkrdf5aQ1FlWElBxoO98F2OWptzr+LVmp6BnYe+cngj/zTlGZJY0ZUBHbwjJK0R3YwVMafRvzHFSRrp+74PdLssxK4ZL2Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=T0u79BM5; arc=none smtp.client-ip=91.218.175.173 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="T0u79BM5" X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1779021289; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=STBdzgKjvPOvwUZo4dBwGw6O4WoEeCxQfi7KFeellUE=; b=T0u79BM5I9Gt9t7TqvxKLffnWzUEMms/F/PWT1x7sbrwkhHY+qo4LUD65kjSwhOxB0o4NT riHelewZfb4UdSKs72CHbsCj8IxZA//KgKKj4PgIGIBU4CuTZu3II9Otv0vMdKReM35pYg mCg25CEgPq3dkR1sKgqaxRIuPKLxJzU= From: Thorsten Blum To: Andrew Morton , David Hildenbrand , Lorenzo Stoakes , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , Yury Norov , Rasmus Villemoes , Andy Shevchenko Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Thorsten Blum Subject: [PATCH 1/3] mm: move offset_in_page() to page_helpers.h Date: Sun, 17 May 2026 14:34:29 +0200 Message-ID: <20260517123428.1181981-4-thorsten.blum@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1534; i=thorsten.blum@linux.dev; h=from:subject; bh=MrC+0YWETyNYg6CxOeGPNoPuLtOeYreu8yN0bDb2ezY=; b=owGbwMvMwCUWt7pQ4caZUj3G02pJDFmcW6849C6U8ub++mfV7aOFvzdIRv0OzGtxXzJT9Yg15 /kZf25f7ChlYRDjYpAVU2R5MOvHDN/SmspNJhE7YeawMoEMYeDiFICJTNzL8N8h6E5glljGhMjS T2IXV+rua7atXW+4TetxydtlXMEL/5gx/C9k8+I/OXPjQ93SHr/fjZxSF3iZbm4JUuapeOenJLy 5kRUA X-Developer-Key: i=thorsten.blum@linux.dev; a=openpgp; fpr=1D60735E8AEF3BE473B69D84733678FD8DFEEAD4 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Move offset_in_page() out of linux/mm.h so users that only need page offset calculations can include this lightweight header instead of pulling in all of linux/mm.h. Signed-off-by: Thorsten Blum --- include/linux/mm.h | 2 +- include/linux/page_helpers.h | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 include/linux/page_helpers.h diff --git a/include/linux/mm.h b/include/linux/mm.h index af23453e9dbd..bf49e52f749a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -3033,7 +3034,6 @@ static inline void clear_page_pfmemalloc(struct page *page) */ extern void pagefault_out_of_memory(void); -#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) #define offset_in_folio(folio, p) ((unsigned long)(p) & (folio_size(folio) - 1)) /* diff --git a/include/linux/page_helpers.h b/include/linux/page_helpers.h new file mode 100644 index 000000000000..102a4f3c3868 --- /dev/null +++ b/include/linux/page_helpers.h @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _LINUX_PAGE_HELPERS_H +#define _LINUX_PAGE_HELPERS_H + +#include + +#define offset_in_page(p) ((unsigned long)(p) & ~PAGE_MASK) + +#endif /* _LINUX_PAGE_HELPERS_H */