From patchwork Wed Dec 16 18:23:18 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 11978413 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53F4EC2BBCA for ; Wed, 16 Dec 2020 18:47:26 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id EB63E233F6 for ; Wed, 16 Dec 2020 18:47:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EB63E233F6 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 90A618D0010; Wed, 16 Dec 2020 13:47:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 88E218D0002; Wed, 16 Dec 2020 13:47:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7CC6A8D0010; Wed, 16 Dec 2020 13:47:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0097.hostedemail.com [216.40.44.97]) by kanga.kvack.org (Postfix) with ESMTP id 664848D0002 for ; Wed, 16 Dec 2020 13:47:20 -0500 (EST) Received: from smtpin03.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 32078362E for ; Wed, 16 Dec 2020 18:47:20 +0000 (UTC) X-FDA: 77600028240.03.fuel65_2015c752742e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin03.hostedemail.com (Postfix) with ESMTP id 0F1D528A4E9 for ; Wed, 16 Dec 2020 18:47:20 +0000 (UTC) X-HE-Tag: fuel65_2015c752742e X-Filterd-Recvd-Size: 2991 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf34.hostedemail.com (Postfix) with ESMTP for ; Wed, 16 Dec 2020 18:47:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=OlRS9lx7lNND7A1m3ILFo70Suk24v9UQeorfTiAX4i0=; b=bJ+rQJJByhvyzull344NyNGyXE m8z07AixUU9emwwkkl9894o7Qgsx5c3cxoaE/R4bmqTEVD8gN/RdypHQ2dc/XdidkG4J8UT2/82jY gGvAG/xKQU8Aga2O8mdb4bwfAiJiQbMn8dGdxABi2QavHhnfKrjJOmXh/E6leD6w7x3GXrQ89RWh8 /TmqVM39uMjbeKWeiqWwiCGynfLF6u4CyBwYk9NGq1tOmDsYVROjfHvw7RPZYqPI4Y3fPwedPNFvw 6+UV7tLpDsemZHRVu420e1IspNZmrNoK/xALG2vTftXBUCTUcVhzH2+MXAIr3aAPbYDw+ZsFxvKTx O6NzZJ1g==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kpbSc-00076g-IH; Wed, 16 Dec 2020 18:23:39 +0000 From: "Matthew Wilcox (Oracle)" To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" , linux-kernel@vger.kernel.org Subject: [PATCH 08/25] mm: Add __alloc_folio_node and alloc_folio Date: Wed, 16 Dec 2020 18:23:18 +0000 Message-Id: <20201216182335.27227-9-willy@infradead.org> X-Mailer: git-send-email 2.21.3 In-Reply-To: <20201216182335.27227-1-willy@infradead.org> References: <20201216182335.27227-1-willy@infradead.org> MIME-Version: 1.0 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 wrappers are mostly for typesafety, but they also ensure that the page allocator allocates a compound page. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/gfp.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 53caa9846854..9e416efb4ff8 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -524,6 +524,12 @@ __alloc_pages_node(int nid, gfp_t gfp_mask, unsigned int order) return __alloc_pages(gfp_mask, order, nid); } +static inline +struct folio *__alloc_folio_node(int nid, gfp_t gfp, unsigned int order) +{ + return (struct folio *)__alloc_pages_node(nid, gfp | __GFP_COMP, order); +} + /* * Allocate pages, preferring the node given as nid. When nid == NUMA_NO_NODE, * prefer the current CPU's closest node. Otherwise node must be valid and @@ -565,6 +571,11 @@ static inline struct page *alloc_pages(gfp_t gfp_mask, unsigned int order) #define alloc_page_vma(gfp_mask, vma, addr) \ alloc_pages_vma(gfp_mask, 0, vma, addr, numa_node_id(), false) +static inline struct folio *alloc_folio(gfp_t gfp, unsigned int order) +{ + return (struct folio *)alloc_pages(gfp | __GFP_COMP, order); +} + extern unsigned long __get_free_pages(gfp_t gfp_mask, unsigned int order); extern unsigned long get_zeroed_page(gfp_t gfp_mask);