From patchwork Fri Apr 29 19:23:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 12832649 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 96D40C433EF for ; Fri, 29 Apr 2022 19:24:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D5CA26B007D; Fri, 29 Apr 2022 15:23:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 710346B0087; Fri, 29 Apr 2022 15:23:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0AE766B008C; Fri, 29 Apr 2022 15:23:42 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 9471D6B0089 for ; Fri, 29 Apr 2022 15:23:42 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6F81F284EB for ; Fri, 29 Apr 2022 19:23:42 +0000 (UTC) X-FDA: 79410891084.06.5E151B0 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf31.hostedemail.com (Postfix) with ESMTP id DDCDD20066 for ; Fri, 29 Apr 2022 19:23:30 +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=ghuyNPaRYcVBS9VmCa9+k4jYQUr1mhpvqirNEm+8qiE=; b=T06oJDalPvMS3Jhsnk53Gzny0t mEq4F2DrXMJ0knAZDUsYBvLUnkIP+DYljrE8+xmTUmjYU9kRkf8FiwLmBYLhIP5yLv3nA+JDCmsle R8xZt3daICt8Swu76oM0FUMs1NkgtAIXXa8VreS9GNOKX1aSRbbjYqGq6ApBI2W+nor3+bKT9W3Wl N5HWmj04GmXnzm4Jlw8Vhqt4sTe/xKZmvFPLEg3tQ5nCC5pwYvv63aCO/t0BE2nbUQIk8Q3zRacXT oCw3bRcXWrRQPr0xRoX/ghqJmrBPWQDJt+ao3oCmNUCYyjlu703BWl43GJKCyYoB6LDc5wLxmyP/X dIeNJepA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1nkWDJ-00CjOg-1K; Fri, 29 Apr 2022 19:23:37 +0000 From: "Matthew Wilcox (Oracle)" To: akpm@linuxfoundation.org Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Subject: [PATCH 01/21] shmem: Convert shmem_alloc_hugepage() to use vma_alloc_folio() Date: Fri, 29 Apr 2022 20:23:09 +0100 Message-Id: <20220429192329.3034378-2-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20220429192329.3034378-1-willy@infradead.org> References: <20220429192329.3034378-1-willy@infradead.org> MIME-Version: 1.0 X-Stat-Signature: ccee735etzfdkmyf3j11qm5zh5eh8eoi X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: DDCDD20066 X-Rspam-User: Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=T06oJDal; dmarc=none; spf=none (imf31.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org X-HE-Tag: 1651260210-149131 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: For now, return the head page of the folio, but remove use of the old alloc_pages_vma() API. Signed-off-by: Matthew Wilcox (Oracle) --- mm/shmem.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/mm/shmem.c b/mm/shmem.c index 4b2fea33158e..c89394221a7e 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1527,7 +1527,7 @@ static struct page *shmem_alloc_hugepage(gfp_t gfp, struct vm_area_struct pvma; struct address_space *mapping = info->vfs_inode.i_mapping; pgoff_t hindex; - struct page *page; + struct folio *folio; hindex = round_down(index, HPAGE_PMD_NR); if (xa_find(&mapping->i_pages, &hindex, hindex + HPAGE_PMD_NR - 1, @@ -1535,13 +1535,11 @@ static struct page *shmem_alloc_hugepage(gfp_t gfp, return NULL; shmem_pseudo_vma_init(&pvma, info, hindex); - page = alloc_pages_vma(gfp, HPAGE_PMD_ORDER, &pvma, 0, true); + folio = vma_alloc_folio(gfp, HPAGE_PMD_ORDER, &pvma, 0, true); shmem_pseudo_vma_destroy(&pvma); - if (page) - prep_transhuge_page(page); - else + if (!folio) count_vm_event(THP_FILE_FALLBACK); - return page; + return &folio->page; } static struct page *shmem_alloc_page(gfp_t gfp,