From patchwork Thu Jul 4 04:30:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oscar Salvador X-Patchwork-Id: 13723184 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 79C93C30653 for ; Thu, 4 Jul 2024 04:32:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 090C76B0099; Thu, 4 Jul 2024 00:32:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F35096B009A; Thu, 4 Jul 2024 00:32:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D3A586B009B; Thu, 4 Jul 2024 00:32:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AAC2A6B0099 for ; Thu, 4 Jul 2024 00:32:00 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 65DF11A0E8D for ; Thu, 4 Jul 2024 04:32:00 +0000 (UTC) X-FDA: 82300797600.23.B1F1ED1 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf30.hostedemail.com (Postfix) with ESMTP id 451898001A for ; Thu, 4 Jul 2024 04:31:58 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="JZiVO/eg"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="yNbA1i/f"; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="JZiVO/eg"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="yNbA1i/f"; spf=pass (imf30.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 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=1720067495; 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=R/rRNjZ7G0L51JRh0RrYbiNiKS2AE7CnLW4VygCa50U=; b=FN4F87yv05pFrewOxBssAiVmPKI3PFiRttKoKTTTV3f/MQR9q10IpRiov/dM7ehPn/YAkw 1n0/wjC4icMpPWBRCQM6nVQb8y76VA6PCTseXy9BHw3uhqH28Koqh5CUSrE0X9AYMJpRL4 QKSvOlLDeMcq6Z7PNOuBs3kNkopJXGM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720067495; a=rsa-sha256; cv=none; b=fEbpP6al6ukHJF2advlVuzqwHxTszzfsTZ1FwUYNPwnzSuIsmzNavQsFe1zsQM7lBtqImj uO5oUHPp5wITTmdtvaRq6oLxT+Klx7sUzWA8zCtS/0jyOjUCis5v12bAJR+pqRwg3IR/br gX+GzxF1UOUmcHVzFGzsnVN73J9KVCs= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="JZiVO/eg"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="yNbA1i/f"; dkim=pass header.d=suse.de header.s=susede2_rsa header.b="JZiVO/eg"; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b="yNbA1i/f"; spf=pass (imf30.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de Received: from imap1.dmz-prg2.suse.org (unknown [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-out2.suse.de (Postfix) with ESMTPS id 0726C1FCF9; Thu, 4 Jul 2024 04:31:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1720067517; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R/rRNjZ7G0L51JRh0RrYbiNiKS2AE7CnLW4VygCa50U=; b=JZiVO/egdO1NVZ9h89++ifx1zQVaAaRFVXTNxdvP7+Eqp6m0SFCnQDqtDBNPLeRwhOr/3k RIAR/120aKOEkaNyNgfpVNaziAWXWsQJTL2b+KTKfAdROuN3yyhKk9oEtfYU7aWFSE8j9d IVYd41OVz8gn1ZHBdLdnAJCiolhzEpA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1720067517; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R/rRNjZ7G0L51JRh0RrYbiNiKS2AE7CnLW4VygCa50U=; b=yNbA1i/f3g+Uk1+/g4XzzNXwTBw31YbefcoyfvVe9XSdiq9mU3Rgm3u5T2CICi+Xi0VqWq O+llDAuqdN+YiJDA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1720067517; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R/rRNjZ7G0L51JRh0RrYbiNiKS2AE7CnLW4VygCa50U=; b=JZiVO/egdO1NVZ9h89++ifx1zQVaAaRFVXTNxdvP7+Eqp6m0SFCnQDqtDBNPLeRwhOr/3k RIAR/120aKOEkaNyNgfpVNaziAWXWsQJTL2b+KTKfAdROuN3yyhKk9oEtfYU7aWFSE8j9d IVYd41OVz8gn1ZHBdLdnAJCiolhzEpA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1720067517; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R/rRNjZ7G0L51JRh0RrYbiNiKS2AE7CnLW4VygCa50U=; b=yNbA1i/f3g+Uk1+/g4XzzNXwTBw31YbefcoyfvVe9XSdiq9mU3Rgm3u5T2CICi+Xi0VqWq O+llDAuqdN+YiJDA== 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 DE2E513A82; Thu, 4 Jul 2024 04:31:55 +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 WPQSMrslhmbnDAAAD6G6ig (envelope-from ); Thu, 04 Jul 2024 04:31:55 +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 06/45] mm/pagewalk: Do not try to split non-thp pud or pmd leafs Date: Thu, 4 Jul 2024 06:30:53 +0200 Message-ID: <20240704043132.28501-7-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-Queue-Id: 451898001A X-Stat-Signature: rgpjtwi5c6chznfi9gtbkx7mbw44ysry X-Rspamd-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mwS2lAFe6uBvLK9DjxBQ7qArNeX3a7sAQRqOwl7GtLxJyWfGSkKDbmkJH/Sd/oGi24vqpnR+csJjGomIxq9C7ZAhF/WtesOBPghlJFYroH+leyzlm9NqDrJ3iYKQbZIJ1uIs14TgRqPK59CCEZwVjR4tKOPF7B2PvJlNgiK+wXVzCXbi0/T02qQhDHaNiI= 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: Hugetlb pages will be handled in the generic path, so do not try to split pud or pmd leafs if they are not thp. Signed-off-by: Oscar Salvador --- mm/pagewalk.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mm/pagewalk.c b/mm/pagewalk.c index a9c36f9e9820..78d45f1450aa 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -119,7 +119,8 @@ static int walk_pmd_range(pud_t *pud, unsigned long addr, unsigned long end, * Check this here so we only break down trans_huge * pages when we _need_ to */ - if ((!walk->vma && (pmd_leaf(*pmd) || !pmd_present(*pmd))) || + if (((!walk->vma || is_vm_hugetlb_page(walk->vma)) && + (pmd_leaf(*pmd) || !pmd_present(*pmd))) || walk->action == ACTION_CONTINUE || !(ops->pte_entry)) continue; @@ -169,7 +170,8 @@ static int walk_pud_range(p4d_t *p4d, unsigned long addr, unsigned long end, if (walk->action == ACTION_AGAIN) goto again; - if ((!walk->vma && (pud_leaf(*pud) || !pud_present(*pud))) || + if (((!walk->vma || is_vm_hugetlb_page(walk->vma)) && + (pud_leaf(*pud) || !pud_present(*pud))) || walk->action == ACTION_CONTINUE || !(ops->pmd_entry || ops->pte_entry)) continue;