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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 900F7C54E68 for ; Thu, 21 Mar 2024 14:25:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D4D3F6B008A; Thu, 21 Mar 2024 10:25:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CD5BC6B008C; Thu, 21 Mar 2024 10:25:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B4FBD6B0092; Thu, 21 Mar 2024 10:25:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id A02006B008A for ; Thu, 21 Mar 2024 10:25:01 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id C691C1A0260 for ; Thu, 21 Mar 2024 14:25:00 +0000 (UTC) X-FDA: 81921267960.19.A258214 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf19.hostedemail.com (Postfix) with ESMTP id 863D11A0016 for ; Thu, 21 Mar 2024 14:24:58 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ukRKoFAj; dmarc=none; spf=none (imf19.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=1711031099; a=rsa-sha256; cv=none; b=X6O3WKleNVpjZLK8ONvMqsDbhP+9rdpzEkrjSQeNDosnQjxeBVTe2ratBOXxG6L/a+EARd vgAG1hO8e3+rN2YkMt4U4Z3gTalNrjxrojG9MP0Em4ThzfzIGJmKmt2HihoRYeCR21GSO4 PB4AuyJ2iJovt5yS8Aat3cCEoxPTmV8= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=ukRKoFAj; dmarc=none; spf=none (imf19.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=1711031099; 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=kMnaFf5hqRgc9vfkJ4p3HF/QxzQ4aaa8vBIiVKvak3s=; b=UeuMekWw3mlRtuwtSeJ36u+MVdHWUSaI/a1ExXsZyn35slbGhx1FgvrgPnG25VLt7ODqb1 JKe1K4xfDT7/5u5av7bvJRzTmc/lllBn7ejwYN8BrGapzuvNBSfSRSAhtm0qus1EkTiF97 F9IQSPDu1/Iu0+86LHdfg/K63lDnTGA= 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=kMnaFf5hqRgc9vfkJ4p3HF/QxzQ4aaa8vBIiVKvak3s=; b=ukRKoFAjG0tsH+qK3TeHNEtGeG KQw4Djf3QaezfNAHr7FgtNdye0j+Et3V9i/iTrZ6Kql4uf+VYlj0zKFh2EQ/KM27O8dV3FbvGBvr9 e5XMSeBH4EZqyrrXr7td/vs5VO0sSS/0/hPkmZ5+D64DoAQw8/t9VTScDmbHJNYlF5Hzib+WH1luZ 5VzWKzwEgpmdVlL7XgIVEmT/aSIhRSNQX6rnR52CvX3B6Lzu92zSwWW52ydgIG9Z05+n2boCPYoqC NnzNd6NEKBcRngsFwIzGr+2e9uH3zd5r9Wbh60mLVMzg777VyFLe2LsDztusnh85G1qYR8UBYbYpE 4Kx/lB9w==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rnJLf-00000006u4A-4938; Thu, 21 Mar 2024 14:24:52 +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 9/9] hugetlb: Remove mention of destructors Date: Thu, 21 Mar 2024 14:24:47 +0000 Message-ID: <20240321142448.1645400-10-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 Content-Transfer-Encoding: 8bit X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 863D11A0016 X-Stat-Signature: cztx8ti3np9mdo9ypg3xc41j8py5tyg7 X-HE-Tag: 1711031098-399038 X-HE-Meta: U2FsdGVkX18aeGGrNS2hQTo8kwVwDIDxa1FM488QiXU2i7J9QDA+0HaK9jWcY9P782qFGE9vu7hQJDaFBgh9YEgm4XJYY09SUwxCV1Tjh4zV0CawbuE7ArCnqlVHz6ftSHvHbXEKUgQaiA404OSIYziH15tTts5E2r5khT6gC2l5EcViJaMpY89sIFxSdS4ZhjEnMC16GinI6rbkQzYOk+VrD8nh+Knz3bSreQlMYjQgtGQo2mL0Dbt5GMLxxLkiB6LV37DytcpD/SCPL6bLWm6t5CyQhkb68E2NowVWhAKjc9hLqOPN0mU1DrwodV4eWsZAOcTyk1i+S25gZWNKPBTvJX496UxNOeY7ccGHwnucm/0HEQF6xe7G2QIC5AwHNsLsRlmrn4E1OOMLmxmDKwsnvJa/Qzg36hrU76Z3RLTyK92T+1hutYpht9cCIre2jJlUkkdmaGeRO/sYlQmZW6v2SZopqoyF76M2iiEn+WuCNr1gcnFaUDN3L2WKkcWf2N45kJBGKWe1CCqipCjBRfOKNJHbXC02BQLeguud0ibSl+9k8Qks9qrSM+dNfzkFyyNLv3hmG6oeRQWBkx+I5+0FvbhztavL+EpfUJvuPEP2O/c0C9I0Ga3jOvnD9C/hywtOYeeF3se7ybWitrfY7iPzNfdhJ7Se5zD7iAJgEmPQi0SO1PW8SIERRXqpCCjehwZPHfV0ZBltNnudksxwe4ZlzOW3dI2OODf6ilDPtqaYeg9JDW7D40RtOe8MLxkz7EVJ3re0gewOi00aVdtV41iYVSo5Rj6/1OwCaKuUVv48kOjlAZSSkyODvvaf023+lqOcg2HdBchaM2k8ZpqPDzhL9VK9fKt2x7TFPMmrMyhQgS2HOynF+3jiEov9XEVHOQVKg18iV4cFzO7V4dLypxuFPTtqO9f1+t2KffWqVxvGn55RR5q+eBHYvk0gvv8yCEeIrABIhBU7LxSzzDT t9kegqtA AuJKBB77u0P7AIp6xBVdVqKkp/PrT03EQ1dYUN2JHSS3TU2MG3BoOEDu83Ee3Fl5RvKELTefxUoDNcSJBQyNaxiu82ZFCW1ZcMU61rylyoBX8U6NH0y/273IYyp/sWy3rBLSme4bUUVvJd4uL4Z7bH8SMGyXPOubmvW7psLep+Ty6bKte98jKDyr6ww== 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: We no longer have destructors or dtors, merely a page flag (technically a page type flag, but that's an implementation detail). Remove __clear_hugetlb_destructor, fix up comments and the occasional variable name. Signed-off-by: Matthew Wilcox (Oracle) --- mm/hugetlb.c | 42 +++++++++++++++++------------------------- 1 file changed, 17 insertions(+), 25 deletions(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index bdcbb62096cf..6ca9ac90ad35 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1619,19 +1619,11 @@ static inline void destroy_compound_gigantic_folio(struct folio *folio, unsigned int order) { } #endif -static inline void __clear_hugetlb_destructor(struct hstate *h, - struct folio *folio) -{ - lockdep_assert_held(&hugetlb_lock); - - __folio_clear_hugetlb(folio); -} - /* * Remove hugetlb folio from lists. - * If vmemmap exists for the folio, update dtor so that the folio appears - * as just a compound page. Otherwise, wait until after allocating vmemmap - * to update dtor. + * If vmemmap exists for the folio, clear the hugetlb flag so that the + * folio appears as just a compound page. Otherwise, wait until after + * allocating vmemmap to clear the flag. * * A reference is held on the folio, except in the case of demote. * @@ -1662,12 +1654,12 @@ static void __remove_hugetlb_folio(struct hstate *h, struct folio *folio, } /* - * We can only clear the hugetlb destructor after allocating vmemmap + * We can only clear the hugetlb flag after allocating vmemmap * pages. Otherwise, someone (memory error handling) may try to write * to tail struct pages. */ if (!folio_test_hugetlb_vmemmap_optimized(folio)) - __clear_hugetlb_destructor(h, folio); + __folio_clear_hugetlb(folio); /* * In the case of demote we do not ref count the page as it will soon @@ -1741,7 +1733,7 @@ static void add_hugetlb_folio(struct hstate *h, struct folio *folio, static void __update_and_free_hugetlb_folio(struct hstate *h, struct folio *folio) { - bool clear_dtor = folio_test_hugetlb_vmemmap_optimized(folio); + bool clear_flag = folio_test_hugetlb_vmemmap_optimized(folio); if (hstate_is_gigantic(h) && !gigantic_page_runtime_supported()) return; @@ -1754,11 +1746,11 @@ static void __update_and_free_hugetlb_folio(struct hstate *h, return; /* - * If folio is not vmemmap optimized (!clear_dtor), then the folio + * If folio is not vmemmap optimized (!clear_flag), then the folio * is no longer identified as a hugetlb page. hugetlb_vmemmap_restore_folio * can only be passed hugetlb pages and will BUG otherwise. */ - if (clear_dtor && hugetlb_vmemmap_restore_folio(h, folio)) { + if (clear_flag && hugetlb_vmemmap_restore_folio(h, folio)) { spin_lock_irq(&hugetlb_lock); /* * If we cannot allocate vmemmap pages, just refuse to free the @@ -1779,11 +1771,11 @@ static void __update_and_free_hugetlb_folio(struct hstate *h, /* * If vmemmap pages were allocated above, then we need to clear the - * hugetlb destructor under the hugetlb lock. + * hugetlb flag under the hugetlb lock. */ - if (clear_dtor) { + if (clear_flag) { spin_lock_irq(&hugetlb_lock); - __clear_hugetlb_destructor(h, folio); + __folio_clear_hugetlb(folio); spin_unlock_irq(&hugetlb_lock); } @@ -1885,7 +1877,7 @@ static void bulk_vmemmap_restore_error(struct hstate *h, list_for_each_entry_safe(folio, t_folio, non_hvo_folios, lru) { list_del(&folio->lru); spin_lock_irq(&hugetlb_lock); - __clear_hugetlb_destructor(h, folio); + __folio_clear_hugetlb(folio); spin_unlock_irq(&hugetlb_lock); update_and_free_hugetlb_folio(h, folio, false); cond_resched(); @@ -1910,7 +1902,7 @@ static void bulk_vmemmap_restore_error(struct hstate *h, } else { list_del(&folio->lru); spin_lock_irq(&hugetlb_lock); - __clear_hugetlb_destructor(h, folio); + __folio_clear_hugetlb(folio); spin_unlock_irq(&hugetlb_lock); update_and_free_hugetlb_folio(h, folio, false); cond_resched(); @@ -1943,14 +1935,14 @@ static void update_and_free_pages_bulk(struct hstate *h, * should only be pages on the non_hvo_folios list. * Do note that the non_hvo_folios list could be empty. * Without HVO enabled, ret will be 0 and there is no need to call - * __clear_hugetlb_destructor as this was done previously. + * __folio_clear_hugetlb as this was done previously. */ VM_WARN_ON(!list_empty(folio_list)); VM_WARN_ON(ret < 0); if (!list_empty(&non_hvo_folios) && ret) { spin_lock_irq(&hugetlb_lock); list_for_each_entry(folio, &non_hvo_folios, lru) - __clear_hugetlb_destructor(h, folio); + __folio_clear_hugetlb(folio); spin_unlock_irq(&hugetlb_lock); } @@ -1975,7 +1967,7 @@ void free_huge_folio(struct folio *folio) { /* * Can't pass hstate in here because it is called from the - * compound page destructor. + * generic mm code. */ struct hstate *h = folio_hstate(folio); int nid = folio_nid(folio); @@ -2125,7 +2117,7 @@ static bool __prep_compound_gigantic_folio(struct folio *folio, set_compound_head(p, &folio->page); } __folio_set_head(folio); - /* we rely on prep_new_hugetlb_folio to set the destructor */ + /* we rely on prep_new_hugetlb_folio to set the hugetlb flag */ folio_set_order(folio, order); atomic_set(&folio->_entire_mapcount, -1); atomic_set(&folio->_nr_pages_mapped, 0); -- 2.43.0