From patchwork Fri May 20 21:15:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yang Shi X-Patchwork-Id: 12857448 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 8A037C433F5 for ; Fri, 20 May 2022 21:16:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E585D6B0071; Fri, 20 May 2022 17:16:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E07486B0072; Fri, 20 May 2022 17:16:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF6A96B0073; Fri, 20 May 2022 17:16:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id C12096B0071 for ; Fri, 20 May 2022 17:16:13 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 8A72360689 for ; Fri, 20 May 2022 21:16:13 +0000 (UTC) X-FDA: 79487379426.01.19EA75C Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by imf13.hostedemail.com (Postfix) with ESMTP id C0F41200E0 for ; Fri, 20 May 2022 21:15:48 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id z7-20020a17090abd8700b001df78c7c209so12508803pjr.1 for ; Fri, 20 May 2022 14:16:12 -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=JIyZA5gCg5CAXtiIl9V3hnV4Plu8dZEF0XJ46lUoDcI=; b=fNZazHP6x/Jx1uUnoCCiU6V+dnJ+e35vigaFSLc8Rh4Zp7YU1YB06XnrNL1HX4eNyb PRYSUmNFUGkS6wq1DBbJCfx67xSfa/VLiP4ZDQAtJpJqLqRt2Bo3E89Mh9L8WnlAZOEB htEyOyZvjbMO+RyoJ2ZHu0aSOEKUCr57e3Gh6nFy0Y1BXhnZlNMuzIonX45ejLOEudXE 1CAOehb+DNyJAnqayOLCOPGpJWcNn2CdmnmbknuAQtOF+UnlZr6uY4PkFk93uN25v9vN /szl806U81vvy1KM4V5T9QlkxCS8yeDBFSSWONZKkR29YVcsDF0DYT6v8K3I7c5uu/jg Tl4Q== 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=JIyZA5gCg5CAXtiIl9V3hnV4Plu8dZEF0XJ46lUoDcI=; b=ODr/t8ddb2kthRJrn5vdPrxcb5qXFTZYahG/G3MFmH996VrpvfoQbLHi4hQ//6bsr2 +rKiqKSPbl0A1KQyyM7r1ofgGOz7iqO2RRpaIiVsITHy79YBXdq936qpt3g0hAWjeJ2L fWeORvbGBXJPZtyt5QNRC2enilKDK66rRBYOP1avsd8T/2oq5w8gped7z9CjNyt4mNXJ HZ8dEeJGqyX0z9dN5NFiOoigIXHmtwNs6/dmspYBDiCygy14Jvx+pUBCWJohjgnsaJw9 NFQsW9+hvelsCp+RFBBB4OlGjqZ+RE2CIAFE8CxcAoU7Rv0WJUM+XybN/ujG1MowIF+m Rm/w== X-Gm-Message-State: AOAM5310mhNBeZGCzBKy2dIFBOItgxzl+jhxH+45aqxKRSfgXufRp9EK MeGuh/aL2OLF55bekjot3Lg= X-Google-Smtp-Source: ABdhPJyVmX+ajQFQxfZoPz3mdfjK2di45T69FoT0OU9SHu0WufoGwM4/9rD/TcimX9HzPDNzTNOa4Q== X-Received: by 2002:a17:903:41c1:b0:161:bec6:b308 with SMTP id u1-20020a17090341c100b00161bec6b308mr11808346ple.161.1653081371803; Fri, 20 May 2022 14:16:11 -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 h1-20020a170902748100b0015e8d4eb2c2sm167620pll.268.2022.05.20.14.16.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 May 2022 14:16:10 -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 PATCH 0/7] Cleanup transhuge_xxx helpers Date: Fri, 20 May 2022 14:15:58 -0700 Message-Id: <20220520211605.51473-1-shy828301@gmail.com> X-Mailer: git-send-email 2.26.3 MIME-Version: 1.0 X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C0F41200E0 X-Stat-Signature: 39zcneddpqsp3mkh1ei9kw8rrps5m3t9 X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=fNZazHP6; spf=pass (imf13.hostedemail.com: domain of shy828301@gmail.com designates 209.85.216.52 as permitted sender) smtp.mailfrom=shy828301@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-HE-Tag: 1653081348-421332 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: 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. b/fs/proc/task_mmu.c | 4 +- b/include/linux/huge_mm.h | 102 ++++++++++++++++++++++++++----------------------------------------- b/include/linux/khugepaged.h | 21 +------------ b/mm/huge_memory.c | 74 ++++++++++++++++++++++++++++++++++++------------ b/mm/khugepaged.c | 92 ++++++++++++++++-------------------------------------------- b/mm/memory.c | 6 ++- 6 files changed, 129 insertions(+), 170 deletions(-)