From patchwork Thu Dec 21 06:59:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 13515266 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 07C8FC4707B for ; Tue, 9 Jan 2024 19:31:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 90AFA6B0087; Tue, 9 Jan 2024 14:31:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 8BB2B6B009A; Tue, 9 Jan 2024 14:31:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 783446B009B; Tue, 9 Jan 2024 14:31:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 65A4C6B0087 for ; Tue, 9 Jan 2024 14:31:57 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 36819120443 for ; Tue, 9 Jan 2024 19:31:57 +0000 (UTC) X-FDA: 81660767874.10.E098BAE Received: from mail-oi1-f171.google.com (mail-oi1-f171.google.com [209.85.167.171]) by imf18.hostedemail.com (Postfix) with ESMTP id 78C441C0007 for ; Tue, 9 Jan 2024 19:31:55 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BvfUdWc8; spf=pass (imf18.hostedemail.com: domain of shy828301@gmail.com designates 209.85.167.171 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1704828715; a=rsa-sha256; cv=none; b=sP8yrF4RHdf164Q5cbbcRwzTicaicRmF9qCB7up2OE1vPhk3bjFvvcjvo6DX6It9jYWxI6 Fh0V8OZvZyezBV0na4CjlxqLQWNrG74CokcLaZSbXTgDYCdt4BdfRlj4am/5m+jt0GYlBf 8qFO9NAw7BuYcnXZA5OLv6HRscepQeU= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=BvfUdWc8; spf=pass (imf18.hostedemail.com: domain of shy828301@gmail.com designates 209.85.167.171 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1704828715; 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:references:dkim-signature; bh=PBnpa/7xlrSbnA3Nm7BMZMZEN1FuSc8e9znQIZPVWWQ=; b=WCF8ubYRYsKSaFaVOYYHGG6VNM8FqW5TCwzGTh869N/AGoaEWEb8wg3QYdvLESzHXqtoHj q4wRZpeTmGzh4fIU+0HcjP05SmI+dpASr/dvTLfhJu+NTEQ9Cn8OrViN4PAGUnZS6FjfDO 26cUjKd7bgTN7qHngnimma1yaF7Xcgk= Received: by mail-oi1-f171.google.com with SMTP id 5614622812f47-3bba50cd318so3647833b6e.0 for ; Tue, 09 Jan 2024 11:31:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1704828714; x=1705433514; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=PBnpa/7xlrSbnA3Nm7BMZMZEN1FuSc8e9znQIZPVWWQ=; b=BvfUdWc8Odf2bZzt6ZT9RVO8U8hV1fiXzyIOQ1AzKhu6/iGYRQtSu5mV2ZzRN0IL7R KlXeec352y/qH9HDA7ZG1/oxN+zJJd+Jxg2e7b9ttp3RDXANP3aPvhU1lOgRUlA6StK3 HjcuPiThtvJqrIaK+19SUGPSkR2fD436v8j9ctKYX/Lmg3Y2s0UUUiM92nsi9qLojdyf BqvPRfpMAMjW6spIDWnYFkzETJegD5MTztEvoSIUv8F6hy0sikf00uicznGKNyPwHqtw JnAATuh8cUsdR9zKHPmSiWJ/hozKOnamuYJN2EkwqJm15FCgPs8yl2/a6JnAweQPWECA vlaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704828714; x=1705433514; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=PBnpa/7xlrSbnA3Nm7BMZMZEN1FuSc8e9znQIZPVWWQ=; b=GWvVqXtTLbjOa4tdnwkzdthjL+4JrDzhQlnBdKAGStAJdi2yzhj+Wzw/0yEJ0vtQym Sbx5e7Jh2NhhxatyYm+ez5Yv4By6ExhGtwhDLjufgLkddWop4lSnnuTLLzkxoU8Lnovo pP73e8PazYztbJbsPpMsKEhZlkM+JzQh4YgcYeJkn+RcSZtnogHS8JMSKJ/PetrXFBiI 09SCTyjyg5opY/5toGj6uUVGPEZK47102pVGCkrhmT8fgfVurFEWm28tS24DqnPZCXae g82sRZaGanaTKoICgKLyjlN2/kdFUnnkAwsCYtWWKNNMxwtJTXtWVWZs2aIfrNLQhuVp IpsQ== X-Gm-Message-State: AOJu0YyRsd0HoDHyOt+/T7xbTbj6xZqlAbmeAqY2EscAw425nrG7rT2x KOImpRRlNQB82fjCmaBPy3E= X-Google-Smtp-Source: AGHT+IH7zrV9oxl6TmkXukuqZboCYoT7R9fSIVyaATb0QfvPmgkY/BRdMdgTOF5M+7EcvrEZFU4bDg== X-Received: by 2002:a54:4709:0:b0:3bc:3c4a:44b with SMTP id k9-20020a544709000000b003bc3c4a044bmr7023972oik.106.1704828714635; Tue, 09 Jan 2024 11:31:54 -0800 (PST) Received: from localhost.localdomain (c-67-174-241-145.hsd1.ca.comcast.net. [67.174.241.145]) by smtp.gmail.com with ESMTPSA id w2-20020a62c702000000b006d9a0059a9asm2173490pfg.172.2024.01.09.11.31.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 11:31:54 -0800 (PST) From: Yang Shi To: oliver.sang@intel.com, riel@surriel.com, fengwei.yin@intel.com, willy@infradead.org, cl@linux.com, ying.huang@intel.com, akpm@linux-foundation.org Cc: shy828301@gmail.com, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/2] mm: mmap: no need to call khugepaged_enter_vma() for stack Date: Wed, 20 Dec 2023 22:59:42 -0800 Message-Id: <20231221065943.2803551-1-shy828301@gmail.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: 78C441C0007 X-Stat-Signature: h9qj86cgjx8yscac4hc6gi6mnntfnbuu X-Rspam-User: X-HE-Tag: 1704828715-508340 X-HE-Meta: U2FsdGVkX1+GnQ+eIUK1ZSOEdpYMZeQhgSZajCZULYMbeCI6Y9EDcgGL71QITYPamZ8/AURTzAwkKVC5N/pMghW1O3aCOd/o7cBf+FZp46tt1OaKiDKmI+1BMqjhZkV3vKcQGWU7+7FuhCb4E+/FgWQGKul8FbFeF1GjxFunPfyOO599avNaxJ8p8Kuq3CQojJ/bqYSpbmqZ8KDeNjsF0kTpXt4M5+ZVyUxm3W3DLArZlvNKqCfgeTM3x+bg3rVqIfKnoJFw/zXJzzT9pHPEvitVOSOw1uUo7AUw1HwoZ8CUryTjrwU5biT7SVZnhZcN0TT6DdU1b4LHTNUSxOiOhL+OSRxoOvjw859Fj7yo52ivySQIWJJ0OR/eMCEb13hehlUOTgP5OMYIOWIgKVA/n7uMuYbOI0O3kQKp7sYYykLl3pn+8tCwXkAYyJOOnkYiudSZVyfs0+NMGfVgY8GQl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iqXdXvtKc4BDbhGA752zFTqGi1IBTI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000010, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: Yang Shi We avoid allocating THP for temporary stack, even tnough khugepaged_enter_vma() is called for stack VMAs, it actualy returns false. So no need to call it in the first place at all. Signed-off-by: Yang Shi Reviewed-by: Yin Fengwei --- mm/mmap.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index b78e83d351d2..2ff79b1d1564 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -2046,7 +2046,6 @@ static int expand_upwards(struct vm_area_struct *vma, unsigned long address) } } anon_vma_unlock_write(vma->anon_vma); - khugepaged_enter_vma(vma, vma->vm_flags); mas_destroy(&mas); validate_mm(mm); return error; @@ -2140,7 +2139,6 @@ int expand_downwards(struct vm_area_struct *vma, unsigned long address) } } anon_vma_unlock_write(vma->anon_vma); - khugepaged_enter_vma(vma, vma->vm_flags); mas_destroy(&mas); validate_mm(mm); return error;