From patchwork Wed Jun 15 17:29:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12882798 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 58A2DC43334 for ; Wed, 15 Jun 2022 17:29:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B45B96B0071; Wed, 15 Jun 2022 13:29:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AF61E6B0072; Wed, 15 Jun 2022 13:29:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9976E6B0074; Wed, 15 Jun 2022 13:29:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 89CCE6B0071 for ; Wed, 15 Jun 2022 13:29:34 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 5F5E5601E8 for ; Wed, 15 Jun 2022 17:29:34 +0000 (UTC) X-FDA: 79581157068.11.5B0D58C Received: from mail-pg1-f175.google.com (mail-pg1-f175.google.com [209.85.215.175]) by imf05.hostedemail.com (Postfix) with ESMTP id DD029100083 for ; Wed, 15 Jun 2022 17:29:33 +0000 (UTC) Received: by mail-pg1-f175.google.com with SMTP id h192so11994781pgc.4 for ; Wed, 15 Jun 2022 10:29:33 -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=tmRjS93QbcER/KipISqrMEyiblmHFSxAPW8kxLpmooc=; b=KLnFQA3N/38Ci7xwD7pYPH26rby8f9RxbUZsJlp4Rjy0tHdZ3jSJfljdl52oM0yyQf pZ0BKyece6woQWlaxf8di5Fs4iUquUgur2ybWVuQ1PgB1qljENG8+0mjyzFvbhGr5pez PP0QD2BqwiyczlfPE/I5vBtc9cknjBPMF3mfK4xMUiYXw9vEeWNEa2jixr4HkGI5qNEI Hb8N3sH3cSFfoO2rnjEadjbeLiKH8pDooEw2UF6ZGoxA6PxT7ScQZAkteg235WyIsYhF E16bpRQRTBlYrACebvj1ySVcN48JioVMdN0EnlOB8DPoClKkhHcfEtYcIPtDVPQabEcI N1JQ== 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=tmRjS93QbcER/KipISqrMEyiblmHFSxAPW8kxLpmooc=; b=leglGBPxFzOlcgxqVvOnCKpgui30eFhsoHoMNYdVaZ0NBzhBaROo1Kvmiml/C+9im0 iR7kWZuy70vbiKgU4A3Y6JJH5tiZ4mkmPRsJ8v4F7Ob9ISy/RarAKZj+Twf+BdWjuc19 znhTMMR61CebF+cIbhtL/LulFu6LyVpDFtYzeAquCPmmxghOXey0wh/m88vijZru9C8K UWOvR7KyiO7HaXx6fW9WBazZN+Qye1wJW53vVFhmk5YFMcXBsAcaHJYBgIh9G0x0Mrca AF6bZuM+flrFSMMN5F6Z22vQEUEDIAVlDOA/NDI0RBBfATu1IBwgloSm3m/i8AWevcBP B3TA== X-Gm-Message-State: AJIora/RParoHS4t9N5/Ky9+bRUzulOk6AMuuqfKvjjN08F+8pI2MJZ7 aqddR4RXG5/n1P6Bw6KVy7U= X-Google-Smtp-Source: AGRyM1u3+RNW/fGgr0Vv/LcOX4rr7kXu8Qk4YW6i5WFssxnq8oeBhwm8lUVHdPTJqr/7goTW6817/g== X-Received: by 2002:a63:ee54:0:b0:3fe:30cc:899f with SMTP id n20-20020a63ee54000000b003fe30cc899fmr799999pgk.234.1655314172863; Wed, 15 Jun 2022 10:29:32 -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 w14-20020a1709029a8e00b001676f87473fsm9552244plp.302.2022.06.15.10.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 10:29:32 -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 v4 PATCH 0/7] Cleanup transhuge_xxx helpers Date: Wed, 15 Jun 2022 10:29:19 -0700 Message-Id: <20220615172926.546974-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=1655314173; a=rsa-sha256; cv=none; b=p3gnptoC1YaWoUVaZLByYWxt1P+zotTWOHKjQE5SNnt+QoDsQ1BsjQuytKr4r+Zt53AcXt aEa4W6FVuqIBuw+xM1RaC5EsVfrlOAixwAZBMcMqT/fk29Bh0/bljK9m+W7Blzsb6pNEfy 51UtHBtyaLvqQH2NYsCHjRmeE9d1COk= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KLnFQA3N; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of shy828301@gmail.com designates 209.85.215.175 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=1655314173; 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=tmRjS93QbcER/KipISqrMEyiblmHFSxAPW8kxLpmooc=; b=iC6RDx2iJBedk23LEoQ2Y6YHD0vRoIttExJ361tqI+HSzEGKXUB1znVSCWsKgCamblJc6m ecB2+zgrUSWlqzwjNRs1s2oqZo+Wr/MqjDJf+ZUViQfoSV+JGmltNkoblWz8IW0JkaHOKF II7AiqOBmBi7Smei47wFGEJalKdS2nQ= X-Rspamd-Queue-Id: DD029100083 X-Rspam-User: Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=KLnFQA3N; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf05.hostedemail.com: domain of shy828301@gmail.com designates 209.85.215.175 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Rspamd-Server: rspam06 X-Stat-Signature: i9fubtse6adn9gamhaw6e6yd8wr8zwsp X-HE-Tag: 1655314173-318432 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: 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 | 75 +++++++++++++++++++------------------------------------ include/linux/khugepaged.h | 30 ---------------------- mm/huge_memory.c | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++-------- mm/khugepaged.c | 84 +++++++++++++++++++------------------------------------------- mm/memory.c | 7 ++++-- 7 files changed, 130 insertions(+), 153 deletions(-)