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 X-Spam-Level: X-Spam-Status: No, score=-9.5 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, 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 8B6B9C432C1 for ; Wed, 25 Sep 2019 00:52:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4F5E720874 for ; Wed, 25 Sep 2019 00:52:37 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="pQ5Pucn6" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4F5E720874 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 771546B026F; Tue, 24 Sep 2019 20:52:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6F8896B026C; Tue, 24 Sep 2019 20:52:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5282E6B026F; Tue, 24 Sep 2019 20:52:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0091.hostedemail.com [216.40.44.91]) by kanga.kvack.org (Postfix) with ESMTP id F02AC6B026C for ; Tue, 24 Sep 2019 20:52:24 -0400 (EDT) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 968D12C81 for ; Wed, 25 Sep 2019 00:52:24 +0000 (UTC) X-FDA: 75971617008.17.bun62_6c148de16f063 X-HE-Tag: bun62_6c148de16f063 X-Filterd-Recvd-Size: 4176 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) by imf12.hostedemail.com (Postfix) with ESMTP for ; Wed, 25 Sep 2019 00:52:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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:Resent-Date:Resent-From :Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xv/WUgbtqmO8yeljjTDvPzq/gNoRpGQ4K8yB2J8JANQ=; b=pQ5Pucn6DpB0Nn2u6v1J8JtcZG jRr2OOsCdxVdedM65MUAhg3AJ2wNUxUHxdyJULiq/HbDeurkmI/dMeJafXlCohSZNojdCRvqBjXje TFNYwBDYDGNZQei0GPFRZ0UgezdPpJhfggT14HstvnTFUbYVGJQjjDYpIwGnu9Vrc+3FfaQ1H8vZm 7YbMlfeeUjpxSyi23GUmAxLNXAdlhuOYmOxFgByHAJApnyG4ZbEpJVqjuuUOuMqiBwkKhAMytb27e JrEKI2G7Gssy3puSO71D6wDAd7HZEU2LDS6ozP6OI4moMCNHZ7qP/7WpeiX+xVns39fD+NzZArMoC 3tM4PWzA==; Received: from willy by bombadil.infradead.org with local (Exim 4.92.2 #3 (Red Hat Linux)) id 1iCvXV-00076j-I7; Wed, 25 Sep 2019 00:52:17 +0000 From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 08/15] mm: Add __page_cache_alloc_order Date: Tue, 24 Sep 2019 17:52:07 -0700 Message-Id: <20190925005214.27240-9-willy@infradead.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190925005214.27240-1-willy@infradead.org> References: <20190925005214.27240-1-willy@infradead.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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: From: "Matthew Wilcox (Oracle)" This new function allows page cache pages to be allocated that are larger than an order-0 page. Signed-off-by: Matthew Wilcox (Oracle) --- include/linux/pagemap.h | 14 +++++++++++--- mm/filemap.c | 12 ++++++++---- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 103205494ea0..d610a49be571 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -208,14 +208,22 @@ static inline int page_cache_add_speculative(struct= page *page, int count) } =20 #ifdef CONFIG_NUMA -extern struct page *__page_cache_alloc(gfp_t gfp); +extern struct page *__page_cache_alloc_order(gfp_t gfp, unsigned int ord= er); #else -static inline struct page *__page_cache_alloc(gfp_t gfp) +static inline +struct page *__page_cache_alloc_order(gfp_t gfp, unsigned int order) { - return alloc_pages(gfp, 0); + if (order =3D=3D 0) + return alloc_pages(gfp, 0); + return prep_transhuge_page(alloc_pages(gfp | __GFP_COMP, order)); } #endif =20 +static inline struct page *__page_cache_alloc(gfp_t gfp) +{ + return __page_cache_alloc_order(gfp, 0); +} + static inline struct page *page_cache_alloc(struct address_space *x) { return __page_cache_alloc(mapping_gfp_mask(x)); diff --git a/mm/filemap.c b/mm/filemap.c index 625ef3ef19f3..bab97addbb1d 100644 --- a/mm/filemap.c +++ b/mm/filemap.c @@ -962,24 +962,28 @@ int add_to_page_cache_lru(struct page *page, struct= address_space *mapping, EXPORT_SYMBOL_GPL(add_to_page_cache_lru); =20 #ifdef CONFIG_NUMA -struct page *__page_cache_alloc(gfp_t gfp) +struct page *__page_cache_alloc_order(gfp_t gfp, unsigned int order) { int n; struct page *page; =20 + if (order > 0) + gfp |=3D __GFP_COMP; + if (cpuset_do_page_mem_spread()) { unsigned int cpuset_mems_cookie; do { cpuset_mems_cookie =3D read_mems_allowed_begin(); n =3D cpuset_mem_spread_node(); - page =3D __alloc_pages_node(n, gfp, 0); + page =3D __alloc_pages_node(n, gfp, order); + prep_transhuge_page(page); } while (!page && read_mems_allowed_retry(cpuset_mems_cookie)); =20 return page; } - return alloc_pages(gfp, 0); + return prep_transhuge_page(alloc_pages(gfp, order)); } -EXPORT_SYMBOL(__page_cache_alloc); +EXPORT_SYMBOL(__page_cache_alloc_order); #endif =20 /* --=20 2.23.0