From patchwork Wed Dec 1 18:14:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vlastimil Babka X-Patchwork-Id: 12650617 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 8E975C43217 for ; Wed, 1 Dec 2021 18:15:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4CEF66B0081; Wed, 1 Dec 2021 13:15:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 115D56B0072; Wed, 1 Dec 2021 13:15:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DC28E6B0074; Wed, 1 Dec 2021 13:15:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0111.hostedemail.com [216.40.44.111]) by kanga.kvack.org (Postfix) with ESMTP id BC43C6B0073 for ; Wed, 1 Dec 2021 13:15:27 -0500 (EST) Received: from smtpin09.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 7F03318116A55 for ; Wed, 1 Dec 2021 18:15:17 +0000 (UTC) X-FDA: 78870027474.09.5B28DA1 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf21.hostedemail.com (Postfix) with ESMTP id 0F441D035190 for ; Wed, 1 Dec 2021 18:15:16 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 64FB41FD5A; Wed, 1 Dec 2021 18:15:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1638382515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/w5chhh8YYLvgltHSMyWQiSTAqtdsVsIZrIGmVlHmJ4=; b=2Z/iFC7lcZ5H+jnlUo2V94gheiV7g8JITLW+70TKM/Zelhuo6Nno96T85NNpfN945WxEW2 utfhOV6Cn4Yw5bVvsvN48TcA0DKafXODGgozY+4m/7bFihGMbp7FRszEiCJBp/dvjiNLrr rvZxRIVwiLJFdOw4t3BecvRqU7Aa+BI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1638382515; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/w5chhh8YYLvgltHSMyWQiSTAqtdsVsIZrIGmVlHmJ4=; b=tycgaUmvkVUfLq8TBhn9TP+h65Uft6BAm3kHlfDNGGbxNIOYjjG5SkF6a3A405RCJs9d+G 3puyrarRxqQjDpAA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 40CB814050; Wed, 1 Dec 2021 18:15:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id YE3VDrO7p2HPSAAAMHmgww (envelope-from ); Wed, 01 Dec 2021 18:15:15 +0000 From: Vlastimil Babka To: Matthew Wilcox , Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg Cc: linux-mm@kvack.org, Andrew Morton , patches@lists.linux.dev, Vlastimil Babka Subject: [PATCH v2 01/33] mm: add virt_to_folio() and folio_address() Date: Wed, 1 Dec 2021 19:14:38 +0100 Message-Id: <20211201181510.18784-2-vbabka@suse.cz> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211201181510.18784-1-vbabka@suse.cz> References: <20211201181510.18784-1-vbabka@suse.cz> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1138; h=from:subject; bh=mhmYSV3mUW4peqzSqETX0O7Aw92jq0WStnXU/D0a9tI=; b=owEBbQGS/pANAwAIAeAhynPxiakQAcsmYgBhp7tfayXTSar6TgpzBItBpEDWivg05JS4pV3TzbFh uYpJcBOJATMEAAEIAB0WIQSNS5MBqTXjGL5IXszgIcpz8YmpEAUCYae7XwAKCRDgIcpz8YmpEKUdB/ 9U5iwTNrdCu9sy2Kc+wGl1Z5y+h9qUVEPwXCAXKelFoIQ4ryIvjoRkZp/brsFwhN4370dV64csin9o rQQFg1b+9+YgyYPCiqrkcA5eJiq0ikjyJblgnA6JlYM57HDuj+sL/uPrWGSNPvBNog1CkyrJ87B/sW 3nYwzH8m1BZYNbUBkZix+USYtYqDq0x9fcSMwhanbyc/m/5GWucXpf1kJGuhe9RtN2YxJHfXDRwxm3 Flp6TGa4LfyAar1dbKiJsKM7XQZo5goSfpu8ayXsmIe/XfxvjZ33deiMCm2ro6x347AGDjR6d21GH3 WhqPvj+fyx3ZHw0BIwL3rdtmwlWD9u X-Developer-Key: i=vbabka@suse.cz; a=openpgp; fpr=A940D434992C2E8E99103D50224FA7E7CC82A664 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 0F441D035190 X-Stat-Signature: o4r9ayxsxbnamghzmtquuoxhtio1aip7 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="2Z/iFC7l"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=tycgaUmv; spf=pass (imf21.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz; dmarc=none X-HE-Tag: 1638382516-132243 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: These two wrappers around their respective struct page variants will be useful in the following patches. Signed-off-by: Vlastimil Babka Acked-by: Johannes Weiner --- include/linux/mm.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/include/linux/mm.h b/include/linux/mm.h index a7e4a9e7d807..4a6cf22483da 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -863,6 +863,13 @@ static inline struct page *virt_to_head_page(const void *x) return compound_head(page); } +static inline struct folio *virt_to_folio(const void *x) +{ + struct page *page = virt_to_page(x); + + return page_folio(page); +} + void __put_page(struct page *page); void put_pages_list(struct list_head *pages); @@ -1753,6 +1760,11 @@ void page_address_init(void); #define page_address_init() do { } while(0) #endif +static inline void *folio_address(const struct folio *folio) +{ + return page_address(&folio->page); +} + extern void *page_rmapping(struct page *page); extern struct anon_vma *page_anon_vma(struct page *page); extern pgoff_t __page_file_index(struct page *page);