From patchwork Thu Jun 16 17:48:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12884640 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 099AFC43334 for ; Thu, 16 Jun 2022 17:48:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8AC786B0072; Thu, 16 Jun 2022 13:48:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 85BC86B0073; Thu, 16 Jun 2022 13:48:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6FC146B0074; Thu, 16 Jun 2022 13:48:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 61D036B0072 for ; Thu, 16 Jun 2022 13:48:49 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 19BEE120492 for ; Thu, 16 Jun 2022 17:48:49 +0000 (UTC) X-FDA: 79584834378.03.F1DF5ED Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf30.hostedemail.com (Postfix) with ESMTP id A7E0A8008E for ; Thu, 16 Jun 2022 17:48:48 +0000 (UTC) Received: by mail-pl1-f181.google.com with SMTP id y6so1865324plg.0 for ; Thu, 16 Jun 2022 10:48:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=h8VaiU+wdtwucND04NHMKvGiEcGRAR+Ek42xLKO1//A=; b=PikuA1lQkVNweJNVfn6BCJXBju5d1DFaJ9fL4AntcPB4EvTITObGabCUoTMC4Agh5v eAcgU2U7Nb84ZqgwRmpGKMDKhsS979FlE8SEt+Fzq7sMAc5//f5M24DbxFsEUK1yVaFc Snu/uHQlH79PbD8S21Kz4K45Jqcs3T5y3seLR3z3sYsV7f04Uz53ZwWB8e/SpQWGDY3p WFVZgDBXllGal6fHOCbofyBQvRfc9dQAh6rQ6GttvJ/6mabZyrX0agrFLAfm0XEXGgIy WyNx1/h1QUn0cpBoIj9rHEyRHi+JsTA8PHB+X4MZCCD14UqV0Lo8ctf36e+0alGXsgmy 9ofQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=h8VaiU+wdtwucND04NHMKvGiEcGRAR+Ek42xLKO1//A=; b=7aF+vCY6EBrqmR86tRFVDDyGcYURUYpCd/VHyMLN48PEXai8mfs3h8uS9jmoSTrrCD 02isDAO5GVx1subLMZ8Vla+Dw03psDZxzlPGgDqEGFZaIeu4Z1qTcUNBq40LdHDEMx17 gWqiOQEmgDLWJj03dvqnoptV8pEA6R9eI75BdXC592Z43tMqZ/M3hc8J74miXFey0HkK Ix5T4G+SRPenzPY9dRJAwSAxm9Oh1y5wLMSFp8a2uZ2hu2ycC1En++5Rt/LlsJg0DxuW Ejyu80lVMIDQ6B83EapgDYsVvKBC9FSPhwCFfLLkjjNPrveMm0Ld5XXHLLMlBbdPAllz 6vdA== X-Gm-Message-State: AJIora+8hifmaVwtCJOV1LpbEAS2L7tIYAF8X/KvYfSNInsopOz7i6iz FgbCCNgzVss1hRHiqPDsuxs= X-Google-Smtp-Source: AGRyM1v7tKkwxdWNJ9mjdIS8jxopiWFrNTrXTbrer4mCD+IvQj4oczh1vhpUKF2XMNAK6WYP2ARxPg== X-Received: by 2002:a17:90b:1b05:b0:1e2:a053:2fad with SMTP id nu5-20020a17090b1b0500b001e2a0532fadmr17088907pjb.209.1655401727540; Thu, 16 Jun 2022 10:48:47 -0700 (PDT) Received: from localhost.localdomain (c-67-174-241-145.hsd1.ca.comcast.net. [67.174.241.145]) by smtp.gmail.com with ESMTPSA id z21-20020a17090a8b9500b001e8520b211bsm1818289pjn.53.2022.06.16.10.48.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Jun 2022 10:48:46 -0700 (PDT) From: Yang Shi To: vbabka@suse.cz, kirill.shutemov@linux.intel.com, willy@infradead.org, zokeefe@google.com, linmiaohe@huawei.com, akpm@linux-foundation.org Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [mm-unstable v5 PATCH 0/7] Cleanup transhuge_xxx helpers Date: Thu, 16 Jun 2022 10:48:33 -0700 Message-Id: <20220616174840.1202070-1-shy828301@gmail.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1655401728; a=rsa-sha256; cv=none; b=M3fEGE+MZ1M+M/yTkizE84xRKbTIw9FsBM0FkfUt7VklzPOaF1x9/ioCD0WacWPirMBunO paP2BH0S7F01Bupu0uBUri/LfI70nf4MKRZmb6MP5K1njGzljKhow0WcjuQZBCXt4zYNt5 d5RlF1WBp/CxTdcpReod+yYlvUYYu6w= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=PikuA1lQ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of shy828301@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=shy828301@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1655401728; 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=h8VaiU+wdtwucND04NHMKvGiEcGRAR+Ek42xLKO1//A=; b=zPJItek+FgUNqPdpeytNYj4fxulyjn2jM/w1K0x+N2PllVB4YNj/ue3NshD7vQ2aWNkv/J iBvENJEQ8HeYVlerUBP2SFNYmZBvRqlR+pIwbJJ8UF0gdwPhf0+0wv9VtL5TwHAAQAm/Kl z+VIwgIyoZdXrLKlo1Yvehv6j7dzW4w= X-Rspamd-Queue-Id: A7E0A8008E X-Rspam-User: Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=PikuA1lQ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf30.hostedemail.com: domain of shy828301@gmail.com designates 209.85.214.181 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Rspamd-Server: rspam06 X-Stat-Signature: czmnrccaideqydf949jmz5e6us1c15wb X-HE-Tag: 1655401728-621456 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: v5: * Removed transparent_hugepage_active() for !THP, per Zach. Patch 4/7 and 5/7 were updated accordingly. * Collected review tags. v4: * Consolidated the transhuge_vma_size_ok() helper proposed in the earlier versions into transhuge_vma_suitable(), per Zach. * Fixed the regression introduced by patch 3/7, per Zach and Miaohe. * Reworded the comment for transhuge_vma_suitable(), per Zach. * Removed khugepaged_enter() per Miaohe. * More comments for hugepage_vma_check(), per Zach. * Squashed patch 4/7 (mm: khugepaged: use transhuge_vma_suitable replace open-code) in the earlier version into patch 2/7 of this version. * Minor correction to the doc about THPeligible (patch 7/7), so the total number of patches is kept 7. v3: * Fixed the comment from Willy v2: * Rebased to the latest mm-unstable * Fixed potential regression for smaps's THPeligible This series is the follow-up of the discussion about cleaning up transhuge_xxx helpers at https://lore.kernel.org/linux-mm/627a71f8-e879-69a5-ceb3-fc8d29d2f7f1@suse.cz/. THP has a bunch of helpers that do VMA sanity check for different paths, they do the similar checks for the most callsites and have a lot duplicate codes. And it is confusing what helpers should be used at what conditions. This series reorganized and cleaned up the code so that we could consolidate all the checks into hugepage_vma_check(). The transhuge_vma_enabled(), transparent_hugepage_active() and __transparent_hugepage_enabled() are killed by this series. Yang Shi (7): mm: khugepaged: check THP flag in hugepage_vma_check() mm: thp: consolidate vma size check to transhuge_vma_suitable mm: khugepaged: better comments for anon vma check in hugepage_vma_revalidate mm: thp: kill transparent_hugepage_active() mm: thp: kill __transhuge_page_enabled() mm: khugepaged: reorg some khugepaged helpers doc: proc: fix the description to THPeligible Documentation/filesystems/proc.rst | 4 ++- fs/proc/task_mmu.c | 2 +- include/linux/huge_mm.h | 80 +++++++++++++++++++---------------------------------------- include/linux/khugepaged.h | 30 ---------------------- mm/huge_memory.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- mm/khugepaged.c | 84 +++++++++++++++++++------------------------------------------- mm/memory.c | 7 ++++-- 7 files changed, 130 insertions(+), 158 deletions(-)