From patchwork Mon Jun 6 21:44:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12871103 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 C75EBC43334 for ; Mon, 6 Jun 2022 21:44:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1CDB26B0072; Mon, 6 Jun 2022 17:44:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 17B886B0073; Mon, 6 Jun 2022 17:44:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 01B936B0074; Mon, 6 Jun 2022 17:44:20 -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 E378F6B0072 for ; Mon, 6 Jun 2022 17:44:20 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id BA0E560BCE for ; Mon, 6 Jun 2022 21:44:20 +0000 (UTC) X-FDA: 79549139880.09.553DF74 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) by imf04.hostedemail.com (Postfix) with ESMTP id C4A8040039 for ; Mon, 6 Jun 2022 21:43:58 +0000 (UTC) Received: by mail-pj1-f43.google.com with SMTP id l7-20020a17090aaa8700b001dd1a5b9965so13690029pjq.2 for ; Mon, 06 Jun 2022 14:44:19 -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=p9AymPPffeIR1VQQPaQ/nzlIfZdjrOkxBeqoJZ0QW7Q=; b=dhkIidP9TDH9wpEPcVPvs+yx1doA1HyD65I5go3pCHsNqRF6zO80Q689hhPpcdi1i8 AeNKphBHL/T7ROn1fB0y7y2L0iidfw/exIF8YawilsG+2wnterdE0RDRmpVylpfWoSZB lfNGLPZVBqJqd4+USHbNtDDlZ149kk9NjmwedZ8SbPjVaO0MJaave1Sgz+StKQ4oCr1s TZXlKrfPd0GlE7Brx38GBpq4ZHoKY9kM4tU42VQp1dbPJRBiwtY8ybSeQpkqwU4lce0p ua8lTh72X/bTWX1uFercec6E1TYN9pqZ+pIPi9M4gu4z7rmygORfVX9eAare/XMArw3d 9IsQ== 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=p9AymPPffeIR1VQQPaQ/nzlIfZdjrOkxBeqoJZ0QW7Q=; b=kSWGWPZ709Bp5hlDCbC1iVDd9i/Z7zbO9K6ZYtAbVsJYt9LrOtYMOSOncD+heRevqb 9+KxkWF59bcS9ii8ST63XiqPb2JA9hf3eLkVlx1iMvSRb+vw22bFGivALjORtC6d5cjc LPcgyXFv5FGi9kZwg2pQEVbaL8e3B5je+fl2EOkU4N7pE34wFAu0L/YlLcx0q6vpTAp8 7rakfyI9LeOAxsqNOStIreBV4EFhJo3DRMRXBwED4blQOO6mtOHycq0Ofv+AzHbgGYpH txU+smmKwOkjfigD9cCPWvStuMiBhElZFbr4XE2qkLE9zPXO0xl6oFQ1IcYbvsevFVFb tM2A== X-Gm-Message-State: AOAM531UvKiUXgt+qiyHxl6oHoPUWTizovlU0hXa6u/y5NT8yPvb3R6k WVrZFd2gQiYADMXH5XRp02s= X-Google-Smtp-Source: ABdhPJwKmWKXAYuoYaGrhEXXA0EBVG5iWfr3EaP0Y73mI+/FRVnIsYoqUZ5CgX8LP1Z3jVbZL4+ycQ== X-Received: by 2002:a17:902:ce87:b0:163:fc5e:398b with SMTP id f7-20020a170902ce8700b00163fc5e398bmr25674640plg.125.1654551859268; Mon, 06 Jun 2022 14:44:19 -0700 (PDT) Received: from localhost.biz ([8.25.197.27]) by smtp.gmail.com with ESMTPSA id a4-20020a170903100400b0016397da033csm10881675plb.62.2022.06.06.14.44.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jun 2022 14:44:18 -0700 (PDT) From: Yang Shi To: vbabka@suse.cz, kirill.shutemov@linux.intel.com, willy@infradead.org, akpm@linux-foundation.org Cc: shy828301@gmail.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [mm-unstable v3 PATCH 0/7] Cleanup transhuge_xxx helpers Date: Mon, 6 Jun 2022 14:44:07 -0700 Message-Id: <20220606214414.736109-1-shy828301@gmail.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C4A8040039 X-Stat-Signature: i4c8qrf9pk8euqe875oqchua1o7ect8r X-Rspam-User: Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=dhkIidP9; spf=pass (imf04.hostedemail.com: domain of shy828301@gmail.com designates 209.85.216.43 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1654551838-260931 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: 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. 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(-)