From patchwork Thu Jun 2 18:21:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12868041 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 67783C43334 for ; Thu, 2 Jun 2022 18:22:06 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B7E566B0071; Thu, 2 Jun 2022 14:22:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B30DE6B0073; Thu, 2 Jun 2022 14:22:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F6116B0074; Thu, 2 Jun 2022 14:22:05 -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 8BF006B0071 for ; Thu, 2 Jun 2022 14:22:05 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 5F168813DD for ; Thu, 2 Jun 2022 18:22:05 +0000 (UTC) X-FDA: 79534115010.13.D394CC1 Received: from mail-pj1-f41.google.com (mail-pj1-f41.google.com [209.85.216.41]) by imf02.hostedemail.com (Postfix) with ESMTP id 5327880075 for ; Thu, 2 Jun 2022 18:21:59 +0000 (UTC) Received: by mail-pj1-f41.google.com with SMTP id j7so5619257pjn.4 for ; Thu, 02 Jun 2022 11:22:04 -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=XZg9G1Jigxu5VDpW1ndUwDTe9Jmg6ruXCB1hvTF+Mu4=; b=AmECwCzRA2ye4WTB6kLWt8TCEMR0BwnaoJniQW+diXxpJMhv2pFkKM76UsI2sS8jSg 9irwS2emrAQ1ekIn5UJKoPDsuv0Y0bLe5KqAUngC4QiTn3DaHf/HzA+lFeV+96LBE99i NzvKttHRRLZriAcsH4xrR6Q5v6kmAuiWiUZaSZRn0HH53gU48s36hB3/dCTEkkkBeY24 GvJ3wpUwmHtj1CQhG4aZTZv/waE+MI0lZbU6qvxsWpoNxsB+e0ljiFCh4C4VpPVleU0m C7ET3J077c1nCRhRjMQO87GNMnfmxBgUjYsaWBxTLiUty+r1AQXtDXH7wMbsAFONOvwI e6pQ== 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=XZg9G1Jigxu5VDpW1ndUwDTe9Jmg6ruXCB1hvTF+Mu4=; b=l8oDjndqIkevTn4E5HiOZywZU0QEpFVxI7ObkiXLh2UGepgmCnwlvwuvYV4GaItAwt Fnfn908DylTnMc6gjnl1sR3AhQUlmLWeTDx4j/oqRIhlFqHBaHW8uaz6u4SQ12yw43sI lJjPoY2gdXHUFWFHrTCRXAOIqxWxeUCyHAgxp2Afs9gk956cOhmD/+47hUvKiyJRea4N SY466GEuAkVDKDOu8ZOQS5sxeB1QOrQ3Wd2y5QRx6FxXPU16u8ugxH9JXsth8TQb6ZlO fc2Pq87kD5x3dZetFBw3MkfYqKtCQ/vTRtKwEEZo/tsC63+54zouRanDQFlUXCpkoszo bMcg== X-Gm-Message-State: AOAM5314/8aapWE75mrJ9AFCbHGIlsICxAWNY9ZIY5v5zYOopW06Bu27 lqoJVkqMDI1Sa4YjUFmbecY= X-Google-Smtp-Source: ABdhPJzjVsqBnFCFU8qYje4nhCFPAu9tWLe2d7fZ3U4X/OcnEhKtSWq398rkFx0fPUZvwq/2zuORpw== X-Received: by 2002:a17:903:25c1:b0:164:1517:e8c3 with SMTP id jc1-20020a17090325c100b001641517e8c3mr6325632plb.116.1654194123822; Thu, 02 Jun 2022 11:22:03 -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 t10-20020a1709027fca00b0015f2d549b46sm3866779plb.237.2022.06.02.11.22.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Jun 2022 11:22:03 -0700 (PDT) From: Yang Shi To: vbabka@suse.cz, kirill.shutemov@linux.intel.com, akpm@linux-foundation.org Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [mm-unstable v2 PATCH 0/7] Cleanup transhuge_xxx helpers Date: Thu, 2 Jun 2022 11:21:52 -0700 Message-Id: <20220602182159.248387-1-shy828301@gmail.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 X-Stat-Signature: ze334hn7g1y7p6zq8i3ggn5q48ar5pjq X-Rspam-User: Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=AmECwCzR; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of shy828301@gmail.com designates 209.85.216.41 as permitted sender) smtp.mailfrom=shy828301@gmail.com X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 5327880075 X-HE-Tag: 1654194119-659632 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: 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. Added transhuge_vma_size_ok() helper to remove some duplicate code. Yang Shi (7): mm: khugepaged: check THP flag in hugepage_vma_check() mm: thp: introduce transhuge_vma_size_ok() helper mm: khugepaged: remove the redundant anon vma check mm: khugepaged: use transhuge_vma_suitable replace open-code mm: thp: kill transparent_hugepage_active() mm: thp: kill __transhuge_page_enabled() mm: khugepaged: reorg some khugepaged helpers fs/proc/task_mmu.c | 2 +- include/linux/huge_mm.h | 84 ++++++++++++++++++++++++++++------------------------------------------ include/linux/khugepaged.h | 21 ++---------------- mm/huge_memory.c | 64 +++++++++++++++++++++++++++++++++++++++++++++-------- mm/khugepaged.c | 78 +++++++++++++++-------------------------------------------------- mm/memory.c | 7 ++++-- 6 files changed, 114 insertions(+), 142 deletions(-)