From patchwork Thu Jul 4 04:31:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 13723210 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 D210FC30653 for ; Thu, 4 Jul 2024 04:33:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 687EF6B00BD; Thu, 4 Jul 2024 00:32:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 611556B00C0; Thu, 4 Jul 2024 00:32:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4430A6B00BF; Thu, 4 Jul 2024 00:32:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 1EC2F6B00BD for ; Thu, 4 Jul 2024 00:32:34 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id C9982140A71 for ; Thu, 4 Jul 2024 04:32:33 +0000 (UTC) X-FDA: 82300798986.21.18BC276 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by imf25.hostedemail.com (Postfix) with ESMTP id B3699A0002 for ; Thu, 4 Jul 2024 04:32:31 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720067533; 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; bh=Famt0o018CzjK/D0oDe+3Tk0JBUDuAsygB5SDTmdZI4=; b=hRJ3YG1v/ijxjIcrxjDt4jkYHkWCTMalbMwWBhfdDGcP1fzVRNt6XASopPZamxE8vomOqc 618hN4zkUWyx/CPr7FN/J1GvRxLVIxUFe3g5Pj7Bi3IR9snbCpbxfhZPmFsP19xftN0GTE ahHtE2p0SQaxTVbsupzzG+p/b9CtKi0= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=none; spf=pass (imf25.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.130 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720067533; a=rsa-sha256; cv=none; b=vqn1CDdNKCORh+gGPfWwq8Un4cFQfCpw+9S2duhiv0OvGpAzve2I27Jn5FOlqdo7Qg9DhO cLRfYdm8e75DLBy42zT0G27mBIGkdrcK8ubYBdca+lgmqrwTFOY4HJtOUsUFE4yzn/4muX xpCxfIZ4MtbaudcKS3DNGJO9Oa80IHw= Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 8B3D621180; Thu, 4 Jul 2024 04:32:30 +0000 (UTC) Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7235D13889; Thu, 4 Jul 2024 04:32:29 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id 0HweF90lhmbnDAAAD6G6ig (envelope-from ); Thu, 04 Jul 2024 04:32:29 +0000 From: Oscar Salvador To: Andrew Morton Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, Peter Xu , Muchun Song , David Hildenbrand , SeongJae Park , Miaohe Lin , Michal Hocko , Matthew Wilcox , Christophe Leroy , Oscar Salvador Subject: [PATCH 32/45] mm/hmm: Enable hmm_vma_walk_pmd, to handle hugetlb vmas Date: Thu, 4 Jul 2024 06:31:19 +0200 Message-ID: <20240704043132.28501-33-osalvador@suse.de> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240704043132.28501-1-osalvador@suse.de> References: <20240704043132.28501-1-osalvador@suse.de> MIME-Version: 1.0 X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Action: no action X-Stat-Signature: c5a5ws7g19jbfaefk5nbpbxypr664nm3 X-Rspam-User: X-Rspamd-Queue-Id: B3699A0002 X-Rspamd-Server: rspam02 X-HE-Tag: 1720067551-831683 X-HE-Meta: U2FsdGVkX18V6YhZ9V7ACBsI/0dBA7+yEqFQTo9vkN5LbIplJUPvyKoDTLqTwYAlLbqBjM1vUG+/kCODNjmVSgS+IubOYE2CsugrsFXZuVusws7/H58YaTn2fMGscF9qv9DYwLaCaH57r3CnKu6RnQbOEEwyZTLC/LbFAkPK1IAEjFAfV5SrB+pbdx6MNPjNZvNmTt5TQmdcBS29/uTcsOdDNMyNgQitK4E5ItrihSo269ySYR7huAGGaqsnwNC4axqLQ0nNjkPcxvOoO2zbAbLogwUAVf/U5/AgFkvDz61ihASzQ+azUVbJGURQ3G8mbQ8MOplAMcsnnJZgOsfBnCacA0dfsxmJ2iuoX3Qz1CrjDOC+I4pnFVzLVqhowvKRXXDBh2YNkJr1ZK6bn7NkCX/Y/odRNUycRS4xsRQ0ZZ5rKehZJqgZR7XWb/0tsTATozW3DElCFOc2B2Mh972slitBAXYm07cpgu01jtN9V6FtIHmwcO10GqjRcCTN6exVR0dytVqg8f5B5fVpWPIGxu4E21jCtEM+Dq9kgFEmUO0NDWNLUR1Y1pF2/S9BEpOkhPNAbl1a/GiRkzgEAH8OH1ZaZntpqKEkhWAXN0VSSOnTjqh5RStah1r316eFj9cezni170H1TOkkWGGjeE/OidgWyrOY2a6Hj9+0lJD+igFRTUVLKUDgoPKKwSEGmcX1KwUIMPmSVq4+xj0Z+RlNioIaMbupK+ZsaFkhGq/RBdaarYGj2IlJZJN1hxUAH7OV5c498T7qluj9ExXLvepRvlEttXPre8rvfirW3NMUHdTmIon31f8n4tnAafZ0UGAsQFjOZeSMWRSbHBm8WOo0sV3EYyJ28DfxPbpDriL/NP38odIN/BIIbOhs2b2Q9gb3IA7tRvpz6JsJBvPUtf+0uEf/Qynh0nhCVHWAiHY3g+9V1WQjnHq6FaeOk5Gj7+b2qeA3wci+WlIS058cUVs D3veyEVa d/5i5ehi91r5et+CnrNuNww+jpJUxLv23pcfC3b4hQ2l6Wv955bgdbTbmGjOPQjK76AHJ2snHjIiCAo83ALhYytu3zx97NqJ9cfv2INddHZHBFX0SkKftcyfBDdmMJExnLyFjvj5w5RJUOxrpyD7qI3XUuiV9UDaCFjcxhEvZmZOXrbc= 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: PMD-mapped hugetlb vmas will also reach hmm_vma_walk_pmd. Add the required code so it knows how to handle those there. Signed-off-by: Oscar Salvador --- mm/hmm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/hmm.c b/mm/hmm.c index 7e0229ae4a5a..fbee08973544 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -183,7 +183,7 @@ static inline unsigned long pmd_to_hmm_pfn_flags(struct hmm_range *range, hmm_pfn_flags_order(PMD_SHIFT - PAGE_SHIFT); } -#ifdef CONFIG_TRANSPARENT_HUGEPAGE +#ifdef CONFIG_PGTABLE_HAS_HUGE_LEAVES static int hmm_vma_handle_pmd(struct mm_walk *walk, unsigned long addr, unsigned long end, unsigned long hmm_pfns[], pmd_t pmd) @@ -206,11 +206,11 @@ static int hmm_vma_handle_pmd(struct mm_walk *walk, unsigned long addr, hmm_pfns[i] = pfn | cpu_flags; return 0; } -#else /* CONFIG_TRANSPARENT_HUGEPAGE */ +#else /* CONFIG_PGTABLE_HAS_HUGE_LEAVES */ /* stub to allow the code below to compile */ int hmm_vma_handle_pmd(struct mm_walk *walk, unsigned long addr, unsigned long end, unsigned long hmm_pfns[], pmd_t pmd); -#endif /* CONFIG_TRANSPARENT_HUGEPAGE */ +#endif /* CONFIG_PGTABLE_HAS_HUGE_LEAVES */ static inline unsigned long pte_to_hmm_pfn_flags(struct hmm_range *range, pte_t pte) @@ -336,7 +336,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp, if (pmd_none(pmd)) return hmm_vma_walk_hole(start, end, -1, walk); - if (thp_migration_supported() && is_pmd_migration_entry(pmd)) { + if (is_pmd_migration_entry(pmd)) { if (hmm_range_need_fault(hmm_vma_walk, hmm_pfns, npages, 0)) { hmm_vma_walk->last = addr; pmd_migration_entry_wait(walk->mm, pmdp); @@ -351,7 +351,7 @@ static int hmm_vma_walk_pmd(pmd_t *pmdp, return hmm_pfns_fill(start, end, range, HMM_PFN_ERROR); } - if (pmd_devmap(pmd) || pmd_trans_huge(pmd)) { + if (pmd_devmap(pmd) || pmd_leaf(pmd)) { /* * No need to take pmd_lock here, even if some other thread * is splitting the huge pmd we will get that event through