From patchwork Thu Feb 29 21:20:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13577660 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 5FFA2C54E49 for ; Thu, 29 Feb 2024 21:20:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E4A7E6B0095; Thu, 29 Feb 2024 16:20:49 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DFBCF6B0098; Thu, 29 Feb 2024 16:20:49 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC30C6B0099; Thu, 29 Feb 2024 16:20:49 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id BBFA66B0095 for ; Thu, 29 Feb 2024 16:20:49 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7516E1C0DAA for ; Thu, 29 Feb 2024 21:20:49 +0000 (UTC) X-FDA: 81846111018.16.64E488A Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf01.hostedemail.com (Postfix) with ESMTP id 0721440013 for ; Thu, 29 Feb 2024 21:20:47 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=nNjEnO+Y; spf=none (imf01.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709241648; 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=d6YAOLRyze9pUqr090tM/X/89q/P+WFOvNXqhLU+P3o=; b=pC8zAVXFgjvvDsf8yKGuZ8COi7I2XJfVvI7M1EAaq4//K/H2XJ9teFWnq0bMv1nRLsfwUz aIGvLcStTq0NBYMjBCLNAQPnz67qSLHjrgOIfBgtgWf2ZmPbbejWlS9nSAJZPABIyYJWgs CvjBkkL86RmrMx6vgSLT/A7ZOV4m2UA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709241648; a=rsa-sha256; cv=none; b=VlQsWuPwG49BHfQOzUcppn5Y+o+5u2x8Gq5NZ4ZJYT67g5xY+PFz6hCx5Ux1w+IDOnNa5d ncAAEkzGjQrSFQuutz+Li0HcqKsbo2/GzZntEgOIYo2koFgF25Cs44lD/RBYEsB70eJcHd DTToqqcmUk0pjE7EUwe6ybBwNUucI5A= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=nNjEnO+Y; spf=none (imf01.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none 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=d6YAOLRyze9pUqr090tM/X/89q/P+WFOvNXqhLU+P3o=; b=nNjEnO+YHuauGk9NPE5Gb0fHOa herRFZqoVfF4omiT0dMm/jBoS0s6kNnBWk5D1ttW+2QVBVtaeKnZuJ1m/Fjdlc7Q5OETIpPyVW2n5 JIO06nAMQvgNM3Gcfm1Sj7gTzVlFfvtLLyDXeE28Og+jkz77yDrbYJvDcRuOdKh/I5OHIliX1cRM/ rVP4vFiGWNdKVfZZz8qmu+VlAktVNloWim/+ThrGbhZ1ahbvR5iqHSUwBbf5LhN8r942CSUQk+bYe 4EF06oFq72/AtdWBMm+tKB96zVf+ABzwSOzvxIeywk+F/mtvHjEIdy/Ozy+14UQilp4+h3Os1HbNV EVyGaDLA==; Received: from willy by casper.infradead.org with local (Exim 4.97.1 #2 (Red Hat Linux)) id 1rfnpV-0000000949e-3dPr; Thu, 29 Feb 2024 21:20:37 +0000 From: "Matthew Wilcox (Oracle)" To: Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, Miaohe Lin , Naoya Horiguchi Subject: [PATCH 5/8] mm: Convert hugetlb_page_mapping_lock_write to folio Date: Thu, 29 Feb 2024 21:20:31 +0000 Message-ID: <20240229212036.2160900-6-willy@infradead.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240229212036.2160900-1-willy@infradead.org> References: <20240229212036.2160900-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Queue-Id: 0721440013 X-Rspam-User: X-Stat-Signature: dib4z5ta9afs5cf9ayz7ynrxxu4bd5ta X-Rspamd-Server: rspam03 X-HE-Tag: 1709241647-117914 X-HE-Meta: U2FsdGVkX19p+ala2//yFpNDADA/PSU1AQ4T45du+6bG37iP+GzgAZtL47WvQNqsD16Vy27/WGoQjrd8vlmvWjApQQp1ezKbMKGEO9aPP48e5wqto5KqlcpCZKjJaoN5DX1pDDVEi1ZFFeg8NP4QaTZ9R0hqnUX/KpVxn5HkDslFXkMuzid00dLdVsX8Z9re3aSd/TXWTNvadkrcR+Qn8lYNBGjipQ1F0i6pDtk10vG2Y1jo44UrWlxyOhRLRmeVaAACaGoGLeSuIb2YFSfcmbljrN0LbdudtFITy+GDbWYHhJjykIssSBZfut4oaGSwxewAmVgK7wSyPlq4BRaQOrfdtEeTiV7eTlP6DjWB0BDmBgsEz076o0Tb58BOocWV1KSChnfcFgSf1xng59reFAU4EuERVGIhPJ6jdLltm7fbk0e7eAjoxFqNPi9i0Xf73k2MutV2uUhuQNciiJAkxBaBfMiHFPyqAxbrryUINbx3yz2vxxCSTpglLsDmqGSjIPXzGUZbjZvwaw7hfkV/03l3xgrdzyXOnxKnDFZvJyFsTTqkAt7nHenZWFeAHuMUCxwzrH7Hx/uZPqLtx/Q4NwpNnsrlNLamglcQy4h530CYq9OI43nHdYqe20btJks13D1AqRxpggxyFKagX0wzs17NIlRH7CPa7vuTghtcHLZiclt5kOSQJB9DbLYERGhOnM7SfzTUgy54znJKJWaGbjGiAsWJCF4NuNFzMyvkD61uuGjLTXnp7Rb9eHDHdNIGfRqYd1AvYGR91qu1rPcPXQ6+oEGQKhyUnnEDh+L9k5G5mG2foDiyRvD0Wgm4V2lHbLht9G0Mr3/+X2VJsc3zSxYbdCA5ieCpH732IcBVcG8Ax2FDcPHfx6Ceg7IWsZlB1LkbZQJWhLA/aSaoVijyCHYQh/zg+1gp 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: The page is only used to get the mapping, so the folio will do just as well. Both callers already have a folio available, so this saves a call to compound_head(). Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Miaohe Lin --- include/linux/hugetlb.h | 6 +++--- mm/hugetlb.c | 6 +++--- mm/memory-failure.c | 2 +- mm/migrate.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/linux/hugetlb.h b/include/linux/hugetlb.h index 77b30a8c6076..acb1096ecdaa 100644 --- a/include/linux/hugetlb.h +++ b/include/linux/hugetlb.h @@ -175,7 +175,7 @@ u32 hugetlb_fault_mutex_hash(struct address_space *mapping, pgoff_t idx); pte_t *huge_pmd_share(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long addr, pud_t *pud); -struct address_space *hugetlb_page_mapping_lock_write(struct page *hpage); +struct address_space *hugetlb_folio_mapping_lock_write(struct folio *folio); extern int sysctl_hugetlb_shm_group; extern struct list_head huge_boot_pages[MAX_NUMNODES]; @@ -298,8 +298,8 @@ static inline unsigned long hugetlb_total_pages(void) return 0; } -static inline struct address_space *hugetlb_page_mapping_lock_write( - struct page *hpage) +static inline struct address_space *hugetlb_folio_mapping_lock_write( + struct folio *folio) { return NULL; } diff --git a/mm/hugetlb.c b/mm/hugetlb.c index bb17e5c22759..0e464a8f1aa9 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -2178,13 +2178,13 @@ EXPORT_SYMBOL_GPL(PageHuge); /* * Find and lock address space (mapping) in write mode. * - * Upon entry, the page is locked which means that page_mapping() is + * Upon entry, the folio is locked which means that folio_mapping() is * stable. Due to locking order, we can only trylock_write. If we can * not get the lock, simply return NULL to caller. */ -struct address_space *hugetlb_page_mapping_lock_write(struct page *hpage) +struct address_space *hugetlb_folio_mapping_lock_write(struct folio *folio) { - struct address_space *mapping = page_mapping(hpage); + struct address_space *mapping = folio_mapping(folio); if (!mapping) return mapping; diff --git a/mm/memory-failure.c b/mm/memory-failure.c index 27dc21063552..fe4959e994d0 100644 --- a/mm/memory-failure.c +++ b/mm/memory-failure.c @@ -1624,7 +1624,7 @@ static bool hwpoison_user_mappings(struct page *p, unsigned long pfn, * TTU_RMAP_LOCKED to indicate we have taken the lock * at this higher level. */ - mapping = hugetlb_page_mapping_lock_write(hpage); + mapping = hugetlb_folio_mapping_lock_write(folio); if (mapping) { try_to_unmap(folio, ttu|TTU_RMAP_LOCKED); i_mmap_unlock_write(mapping); diff --git a/mm/migrate.c b/mm/migrate.c index 73a052a382f1..0aef867d600b 100644 --- a/mm/migrate.c +++ b/mm/migrate.c @@ -1425,7 +1425,7 @@ static int unmap_and_move_huge_page(new_folio_t get_new_folio, * semaphore in write mode here and set TTU_RMAP_LOCKED * to let lower levels know we have taken the lock. */ - mapping = hugetlb_page_mapping_lock_write(&src->page); + mapping = hugetlb_folio_mapping_lock_write(src); if (unlikely(!mapping)) goto unlock_put_anon;