Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1546845rbb; Mon, 26 Feb 2024 12:56:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCU/4a125DCUKFccC7K9Vcf/5p45i2U3agnCTAdQInQLuUlQWcKafvg0nYkKTM8/nr2Fayn6l3NCobl4eTj4lwEmbMyrU+sHtIOm1PcH8Q== X-Google-Smtp-Source: AGHT+IGZ1R6b6WuAXNeyc41Qz5HwCh/Gxp6LyQHRMQ+QCx40+0WLsJ+fpRRtlQyCgYnz50UaFbZK X-Received: by 2002:a05:6902:3cc:b0:dcb:ce4a:bc2b with SMTP id g12-20020a05690203cc00b00dcbce4abc2bmr310352ybs.51.1708980996151; Mon, 26 Feb 2024 12:56:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708980996; cv=pass; d=google.com; s=arc-20160816; b=UysknaTrcUv3VsflGYuyJOJci3X6MmPsOOWVKkAAzPBMukO9cZRfsmXJ+qPqLjqeJS XYIWwJenVJ6rHKWcqDcvaVnajoGv1b1VlJfJq0HU+O8ahyZSDQHKsCjvEtB3Iv9F33ex hfPd7U8qSNWtvBMb7y0n7TCdqrAMSnl3X44P2lj0NmuikAiWQ/3/Mf1Hy66ABk2sZhui SNOhS4HsgBZ2ExCG+nP9wA8M90t+vlUMhn4DiLiKm8IncFRiXR5IeAQP+7sDAJQt6fDm lScBYQdPeHorzBVI1C4YmkzEs0/cV7e1Hi0pocCBP0Q60+r+C7qLG9WOwvIsnR9bio8q vtRg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=WJOIcMtfPYUOzzIot1iJ43LJYEvqslRWUKho7a0H8UI=; fh=chAWxDyUzR1fRdzViNE01Bcd9wPKK4ot8WI+7Hca+9w=; b=ap7VtzFd7r0/wBTGrKIE8RAk/H0PFBHehDmvWQMFLpca3DZuqp93AwZwe0xLHekMtT HCutWSLF9UB4DJLFgdrqYO5dQtXsu5ukuNFRiqdDJ4hU1ffsmSX4GqMgIJFvI3We3KwR ruzRLONqBtzzw9hcfCc2ADEY1Pak/B6D30+qUlaSqcvh79ISL9NGefTxWKv0sFk1jWag sRo2gSbnfrsvuoneeVecTTvI0Cne3d7ex18+gatZ3Hit5t7eZF1Dbz122F+oi5LX7uAr NtA5OnCUOY071jJHFaunTEW33aHagXNXycSuh8L6SXGRcpuwSCvInn+TKJ11gShXYObc SwzA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@sent.com header.s=fm1 header.b=hJT3EihE; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=Q5oLgEgT; arc=pass (i=1 spf=pass spfdomain=sent.com dkim=pass dkdomain=sent.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=sent.com); spf=pass (google.com: domain of linux-kernel+bounces-82306-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82306-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id q12-20020a05622a04cc00b0042e6df3902asi6478996qtx.285.2024.02.26.12.56.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 12:56:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82306-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@sent.com header.s=fm1 header.b=hJT3EihE; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=Q5oLgEgT; arc=pass (i=1 spf=pass spfdomain=sent.com dkim=pass dkdomain=sent.com dkim=pass dkdomain=messagingengine.com dmarc=pass fromdomain=sent.com); spf=pass (google.com: domain of linux-kernel+bounces-82306-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82306-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=sent.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id D21B41C22DAA for ; Mon, 26 Feb 2024 20:56:35 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 42ADF131E40; Mon, 26 Feb 2024 20:56:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sent.com header.i=@sent.com header.b="hJT3EihE"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Q5oLgEgT" Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7DD7712BEA8; Mon, 26 Feb 2024 20:56:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=66.111.4.29 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708980973; cv=none; b=HpyaGiOyCD6a1BHkyC9VbTI9H17AqWKJrszwGz5k5FcTbGNjOCCZ3/+t63utA027VUcY9pnE0bEbUbt8CwWuieVKktVQe7CAUSzeEkhGoub0HSmOhtABf9aILF7b476AkCbtv4JxBD2uFY/alPIGH5M/p1EPIImltktF6TUSfik= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708980973; c=relaxed/simple; bh=DrLa4gN39OR5eRtafDexilqk38FbJ1y40gc3XkbdbdE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=GUVRCxsS8WDreWGd65SaEDboWZCmepRHjqOOdFq6YlsfbCK5E+swdH/do7cZXkd42ykcXAu9qw4w8Xpsq5MaBYoxOOKy9sEbr8nWg4mEU/0YPQbo2IaYDWW0TyiJqY9a0KnShN7Zarufv3zxGedho2u3E5gje9wFHoa3iTa2TSg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sent.com; spf=pass smtp.mailfrom=sent.com; dkim=pass (2048-bit key) header.d=sent.com header.i=@sent.com header.b=hJT3EihE; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Q5oLgEgT; arc=none smtp.client-ip=66.111.4.29 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=sent.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sent.com Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 102EB5C0098; Mon, 26 Feb 2024 15:56:10 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 26 Feb 2024 15:56:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:reply-to:subject:subject:to:to; s=fm1; t= 1708980970; x=1709067370; bh=WJOIcMtfPYUOzzIot1iJ43LJYEvqslRWUKh o7a0H8UI=; b=hJT3EihEH3zjGCbTc3s5Q1Im8ArJH/JWJT0hNhjb5JGTqkagU5W Q4hNKBxOinzn7ifNib2G/h16pcUfmI1/bqfx0QW9ipxOVL/z73oO0wIhUCRQrKIj QuyalNfeyGJhvoNoBMmNqOoHD+mZAQ4iOtS8zkzd6wxJ8UyxHfUZ7eiBm3YO68zB bD7v8Gb6j9T3B3OXeUkLj/ck3cczpXMLeakNCkel/zMJnic20K6wkIi/8IhA0LwU ozLTnlOLqs47hU/ehXc616Wd6Xip/Gxu9kBPBoJ7LBix5axVEearJu+HgHnojEdA XYKCy/eTe9paK7oZmye1sK5ka3F4fZ6sVbQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1708980970; x=1709067370; bh=WJOIcMtfPYUOzzIot1iJ43LJYEvqslRWUKh o7a0H8UI=; b=Q5oLgEgTHIUoilhhh8ikGrW+fLZkXFebzxvzF+BCqVKz0mFbfKG dNwr2FwozKoylm8kaJXYNkoNFkoj/B6kyoT3uz81JV7UwxrafURxKGHdux6Te0b3 Bni3HMV50CWoYfsL+SLnqjBzl4Ui3boCn2vCF+xDO/x5DeJRTh6DLcbYuO+HHwOi AJLzPdTJ3wgzyZECzE9t6vANiyVrnMz4l/+p78bUdO5MVFirqZUmCBiB3alPjaAb 1ztIjR0tLINoL8O8036DDADyCfaJuyE2PsrIAa3kOJ76zPSKzcVqY/XV/ewhmKav mI2WkIBa2+ajP1dPmr7bZ3UmQU+9kDzWP7g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrgedvgddugedtucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhhrgggtgfesthekredtredtjeenucfhrhhomhepkghi ucgjrghnuceoiihirdihrghnsehsvghnthdrtghomheqnecuggftrfgrthhtvghrnhepje ekteekffelleekudfftdefvddtjeejuedtuedtteegjefgvedtfedujeekieevnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepiihirdihrghnse hsvghnthdrtghomh X-ME-Proxy: Feedback-ID: iccd040f4:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 26 Feb 2024 15:56:08 -0500 (EST) From: Zi Yan To: "Pankaj Raghav (Samsung)" , linux-mm@kvack.org Cc: Zi Yan , "Matthew Wilcox (Oracle)" , David Hildenbrand , Yang Shi , Yu Zhao , "Kirill A . Shutemov" , Ryan Roberts , =?UTF-8?q?Michal=20Koutn=C3=BD?= , Roman Gushchin , "Zach O'Keefe" , Hugh Dickins , Luis Chamberlain , Andrew Morton , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [PATCH v5 1/8] mm/huge_memory: only split PMD mapping when necessary in unmap_folio() Date: Mon, 26 Feb 2024 15:55:27 -0500 Message-ID: <20240226205534.1603748-2-zi.yan@sent.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240226205534.1603748-1-zi.yan@sent.com> References: <20240226205534.1603748-1-zi.yan@sent.com> Reply-To: Zi Yan Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit From: Zi Yan As multi-size THP support is added, not all THPs are PMD-mapped, thus during a huge page split, there is no need to always split PMD mapping in unmap_folio(). Make it conditional. Signed-off-by: Zi Yan --- mm/huge_memory.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 28341a5067fb..b20e535e874c 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2727,11 +2727,14 @@ void vma_adjust_trans_huge(struct vm_area_struct *vma, static void unmap_folio(struct folio *folio) { - enum ttu_flags ttu_flags = TTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD | - TTU_SYNC | TTU_BATCH_FLUSH; + enum ttu_flags ttu_flags = TTU_RMAP_LOCKED | TTU_SYNC | + TTU_BATCH_FLUSH; VM_BUG_ON_FOLIO(!folio_test_large(folio), folio); + if (folio_test_pmd_mappable(folio)) + ttu_flags |= TTU_SPLIT_HUGE_PMD; + /* * Anon pages need migration entries to preserve them, but file * pages can simply be left unmapped, then faulted back on demand. -- 2.43.0