From patchwork Thu Mar 21 14:24:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13598774 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 8D902C54E58 for ; Thu, 21 Mar 2024 14:25:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 251B76B0092; Thu, 21 Mar 2024 10:25:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2028D6B0093; Thu, 21 Mar 2024 10:25:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED4A76B0095; Thu, 21 Mar 2024 10:25:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D352D6B0092 for ; Thu, 21 Mar 2024 10:25:05 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 7AC4F41611 for ; Thu, 21 Mar 2024 14:25:05 +0000 (UTC) X-FDA: 81921268170.11.40F3A8C Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf03.hostedemail.com (Postfix) with ESMTP id DC4642000E for ; Thu, 21 Mar 2024 14:25:03 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=CKN43ljK; dmarc=none; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711031104; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=hEgT0R9QcI74Q3oBDbLmRkwAKlSYxK4VScRXFQScAqA=; b=e/XGyLrfGhb3vl0DDqEN3+hF71WPTmeWvjVTm+0EPx+eErhH0p6d540SQg/Fybdf5BWPVo jmBNMfdo7NMOjf/gerV+MBlBA2c3Xjpdyn9n4NV3omdu8R2+c+m+NbZdFWwwM0vtrJnMvh 9C09Hqizsz7I3kcutR44jr1nXd7/UGk= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=CKN43ljK; dmarc=none; spf=none (imf03.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711031104; a=rsa-sha256; cv=none; b=bgbjXGPG4OIpRppNqexEvTVbJgiFn1po3L9TeUWVvhJHkW7aGJBYJTW01OFOG4vjJFhi+M Jkd8fCwxu3lWEAeJKNOHlZBuOg+vtjeQk4RLmhX6sZXz16wzP/VjBuXQmDif4fGYYVvdZi 4j/F1TR2nsr55IAwg9qArr9jxNrirjM= 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=hEgT0R9QcI74Q3oBDbLmRkwAKlSYxK4VScRXFQScAqA=; b=CKN43ljKVIYmMNstqOZ4ij6FmH 7oZwcwxHAaU9mdhiOY2quY1rITzaqjShTeq2aGv2jS8qkOC8boKGUgjutgaM9FBfaViEbi0T3DDDh l8697w92T+yF4Qp5Key5jPVQjq6Nc1XR3RKELfvUiEk/Sk+bytJwHnes9yWz/sUGN/PpdmxedB62R seNMCDUm+HhZnEkJO1xvM3MKXz1hiZScuEAHi2LpmNYBdIW4AuAz3aYZKU/0D5fo8MAnoT/YaTJNC zP9IC3TGL8uesYxI4zVJoX7tiNZhEr4v3KFkFuYiNxlKX38D4omwq6otc+hKB6YMNss+ROqrtPoM9 9zcji3oQ==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnJLf-00000006u3y-26CJ; Thu, 21 Mar 2024 14:24:51 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, David Hildenbrand , Vlastimil Babka , Miaohe Lin , Muchun Song , Oscar Salvador Subject: [PATCH 3/9] mm: Remove folio_prep_large_rmappable() Date: Thu, 21 Mar 2024 14:24:41 +0000 Message-ID: <20240321142448.1645400-4-willy@infradead.org> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240321142448.1645400-1-willy@infradead.org> References: <20240321142448.1645400-1-willy@infradead.org> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: jpsxp8afq4xhhozxz1qaf8ehnkpjmbq6 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: DC4642000E X-HE-Tag: 1711031103-583990 X-HE-Meta: U2FsdGVkX1+BSSYMDaP9yk8KFpkBRFUKE/8IlqPE2UcJuF8vArKNzGJL27SreF3g1ouJcXpmyFP67DahionnZ0Pg4t1dq3ynhBhKp0fmMpq8Gf+fdr9+x9d4hONEDGArkEgRN2tbaQUMF+MGJDYr43JVLePJ7jM7UFAhxg1/IqO+E9yNvwUvfPja9SKQRu6HlKGVm+UtH0VLtMp9Gc/wtlN85uG2pRmUzg++xi5R1QIrrBCrxA8CqWVYJP0fQIjCM6b0LCFXNvOqK52G07YPDxVkOonbung13FxB9FItD1jlHf1hpnRpnEW7WPvN9yiUl2PFpgxp40qAgMkeuhHUrZoHulzmqb99S9MjL30s6mFi5VNYdzafAUVlTiULCKE+2u+WCFET+7pvHbSFzELK0Jd2Tnstb3Sn9WXf2XARFb92aNzy/f2YQKv3s8StwgccmP/Mq9IvRYExV5lhQQqlvX9LflI66MRFfkSVg0DUuam05l2madlAx07cWGegwbaskQSVn2wYAuk9ycNetm9gU5JfP/+K6yrp7tV/7FsQ8S5I4LWa2+PvENzFRo2MNxS1Tavms3W3TLMU0TbJ2HnTXbK6Fjz2PMaqqrcRSOR5nDvW7mI87jpWoOsiumLYDPw36+GMuSS+6f4dEH53tvs8Rg3F5RXJCxn1AOeKcS/bNfMOOCsyXe5UnmzIiJHtWJDaGqvqc5tYTygTKtUl4DIyBrKuvnuZgAMXJfX3LPcJqtscj4OXCP42le/rTTI0bO2BZFdz70BBJZgYZDtMnm5D4Bm9U8GqWwAmhVCrpGClT+0LwrsBDNlA6NfUUnhKSJWYamNtfkPestuZo3DB5CFOlcb7QhOlFQ7vomFjnxi27c1SKdUDkxFC/B44aTAqYklE9lzq7bQ+8i3ck/DTGy6yeOt1a7KhH2L/P7LAEWSqRyNaVWPJVYSM8KhNCAhtZ0u8g3PEWXpoWzfG013WSdC I9STV9QF w0PJZWl7aKjFfXw7sdzSna/nyXXFRnhnlgdCjA2p7xQ9EGn9/31NxMEsyksvreOgUOEn29FijRR4BpTR+xgSN4DGHvD98BX9YfGnM+2SvuLHB+pi0PYoCm1cxbyl66+2KatX0/dgJJV00UCMlis79hLIPxeE47UuTY73Q9zGngesBObYsx17CjErarQWpB0YjwVekS+E4f69AkmSDKLQXEIf4gi/VGaKvPJIn 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: List-Subscribe: List-Unsubscribe: Now that prep_compound_page() initialises folio->_deferred_list, folio_prep_large_rmappable()'s only purpose is to set the large_rmappable flag, so inline it into the two callers. Take the opportunity to convert the large_rmappable definition from PAGEFLAG to FOLIO_FLAG and remove the existance of PageTestLargeRmappable and friends. Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Vlastimil Babka Reviewed-by: David Hildenbrand --- include/linux/huge_mm.h | 3 --- include/linux/page-flags.h | 4 ++-- mm/huge_memory.c | 9 +-------- mm/internal.h | 3 ++- 4 files changed, 5 insertions(+), 14 deletions(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index de0c89105076..0e16451adaba 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -263,7 +263,6 @@ unsigned long thp_vma_allowable_orders(struct vm_area_struct *vma, unsigned long thp_get_unmapped_area(struct file *filp, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags); -void folio_prep_large_rmappable(struct folio *folio); bool can_split_folio(struct folio *folio, int *pextra_pins); int split_huge_page_to_list_to_order(struct page *page, struct list_head *list, unsigned int new_order); @@ -411,8 +410,6 @@ static inline unsigned long thp_vma_allowable_orders(struct vm_area_struct *vma, return 0; } -static inline void folio_prep_large_rmappable(struct folio *folio) {} - #define transparent_hugepage_flags 0UL #define thp_get_unmapped_area NULL diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index dc1607f1415e..8d0e6ce25ca2 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -869,9 +869,9 @@ static inline void ClearPageCompound(struct page *page) BUG_ON(!PageHead(page)); ClearPageHead(page); } -PAGEFLAG(LargeRmappable, large_rmappable, PF_SECOND) +FOLIO_FLAG(large_rmappable, FOLIO_SECOND_PAGE) #else -TESTPAGEFLAG_FALSE(LargeRmappable, large_rmappable) +FOLIO_FLAG_FALSE(large_rmappable) #endif #define PG_head_mask ((1UL << PG_head)) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 04fb994a7b0b..5cb025341d52 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -788,13 +788,6 @@ struct deferred_split *get_deferred_split_queue(struct folio *folio) } #endif -void folio_prep_large_rmappable(struct folio *folio) -{ - if (!folio || !folio_test_large(folio)) - return; - folio_set_large_rmappable(folio); -} - static inline bool is_transparent_hugepage(struct folio *folio) { if (!folio_test_large(folio)) @@ -2861,7 +2854,7 @@ static void __split_huge_page_tail(struct folio *folio, int tail, clear_compound_head(page_tail); if (new_order) { prep_compound_page(page_tail, new_order); - folio_prep_large_rmappable(new_folio); + folio_set_large_rmappable(new_folio); } /* Finally unfreeze refcount. Additional reference from page cache. */ diff --git a/mm/internal.h b/mm/internal.h index 10895ec52546..ee669963db15 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -513,7 +513,8 @@ static inline struct folio *page_rmappable_folio(struct page *page) { struct folio *folio = (struct folio *)page; - folio_prep_large_rmappable(folio); + if (folio && folio_test_large(folio)) + folio_set_large_rmappable(folio); return folio; }