From patchwork Thu Jan 5 10:18:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Houghton X-Patchwork-Id: 13089642 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 89086C54E76 for ; Thu, 5 Jan 2023 10:19:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2B340900006; Thu, 5 Jan 2023 05:19:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 266498E0001; Thu, 5 Jan 2023 05:19:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 08EF6900006; Thu, 5 Jan 2023 05:19:04 -0500 (EST) 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 E73CA8E0001 for ; Thu, 5 Jan 2023 05:19:03 -0500 (EST) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id A6B8540722 for ; Thu, 5 Jan 2023 10:19:03 +0000 (UTC) X-FDA: 80320347366.16.05D27B4 Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf06.hostedemail.com (Postfix) with ESMTP id 1E2F0180007 for ; Thu, 5 Jan 2023 10:19:01 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=CMFdycOs; spf=pass (imf06.hostedemail.com: domain of 3FaS2YwoKCFwDNBIOABNIHAIIAF8.6IGFCHOR-GGEP46E.ILA@flex--jthoughton.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3FaS2YwoKCFwDNBIOABNIHAIIAF8.6IGFCHOR-GGEP46E.ILA@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1672913942; 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-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=HIG9BIAJU+cdFn89xXe0LNee36+C1EcX0L4kUoSH9VA=; b=notgVjPfF6v0S/IBhxamq2DpQL0GN23AQcdBLBrJhYMEm9L8dV/URnAsXmI8XvCh4pi3sS sOPbiiMB/AB35pMwZQ4rQy0b0cNWd9e76pGuJvX94xmol9v3Aavraj6WbocmOjnwbrOP15 etpPSogiNLLqLpd550MHICP/FsTd9dA= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=CMFdycOs; spf=pass (imf06.hostedemail.com: domain of 3FaS2YwoKCFwDNBIOABNIHAIIAF8.6IGFCHOR-GGEP46E.ILA@flex--jthoughton.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3FaS2YwoKCFwDNBIOABNIHAIIAF8.6IGFCHOR-GGEP46E.ILA@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1672913942; a=rsa-sha256; cv=none; b=sv5pt0w/LUTnaacgS1n2y+tdKx5AzXB7SZsmOUUnt2v+cHAjskdchpiTGCcM46H4aDVQQB xXIXwEfdoifQtyuIQA216JGERafvzlKiltHzXHI0b+fr5+GBq+sF6kUajIpFfbC4PniVlK Wa3hNmImx4mcAot7B0d3inIUSIL9rDg= Received: by mail-yb1-f202.google.com with SMTP id 195-20020a2505cc000000b0071163981d18so36622708ybf.13 for ; Thu, 05 Jan 2023 02:19:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=HIG9BIAJU+cdFn89xXe0LNee36+C1EcX0L4kUoSH9VA=; b=CMFdycOsnlaZrP1tfINkoF9MpUwFHEYphAoiyklgUZsVLZG1tYthaAIbMq5iR4qWCX OXHWYueDyEFCpfBnjUioieM42w8NXjNUz5fmKNAAz8wLLvn5nPj/Bs9/ErfoA3IO4IPY c5oqUYecWCJ1I0u3x2YoT/ifuZ7HYu6l6/zffhFRBo2upvwZyY7aMzs+EuiwuXlkfrtN iASt+00Ipmgct2pD5KbpfbNwwHjYtIXrPj370sJlaEw+j7kbcNb7n2JHv67hdVJRv4uI ls+rD3wSrKgqrGl9nm1pKSRgOs1WF84oEpvybmix2WpHGSw3rcDgV7GQxKLzlEWTzLiD +41A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=HIG9BIAJU+cdFn89xXe0LNee36+C1EcX0L4kUoSH9VA=; b=tRbNCQhhJtDzIQdNJJ2WyW5b5HAmV/SZmPA67wKbxZpck4odLSTcawgdrmxD0fGs2V /mhwKbDUJiep4zEjgFgDBLp9Nlsg9am+2w4WRJ/GevyzVs5F1EM3zDCt84sgMlKUgWiK ozepBQv2WHdBI6+1ARmVahU0QB4V4JOW73AvlD9WoStcNVkFr01X5rfl+0W9vR2y8F2W YD/XO6GEWSHq1/Lq1hWtMVBoPzhsaRLC9K2m5uICL/Kcg5S7ghxB+BmVz6w/Re29mi// pA5rR059/ZcVAEGYA36MC2ptnXrfs0VAWNpoWhMa22sVgkWqwVAF2QfbGYgzjau3SJ6H 4W2Q== X-Gm-Message-State: AFqh2krFdfLXwHt/PNdSn7tszCO3y9VRGpAOmEo8Z3NeU3ezXzdKrUJK zQWjyNUWgG3Yr2fGYINIaCcAEbxSgVD1zGSs X-Google-Smtp-Source: AMrXdXvjR0Xro5c3Mgl40GsMzrllYRIX708i1RiJNWNcFVeIh0ysu1H8PYfOp0t36jr4OJW9kNNJCYFikuDhylAm X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a25:58c3:0:b0:703:5949:3b2a with SMTP id m186-20020a2558c3000000b0070359493b2amr3359803ybb.525.1672913941310; Thu, 05 Jan 2023 02:19:01 -0800 (PST) Date: Thu, 5 Jan 2023 10:18:04 +0000 In-Reply-To: <20230105101844.1893104-1-jthoughton@google.com> Mime-Version: 1.0 References: <20230105101844.1893104-1-jthoughton@google.com> X-Mailer: git-send-email 2.39.0.314.g84b9a713c41-goog Message-ID: <20230105101844.1893104-7-jthoughton@google.com> Subject: [PATCH 06/46] mm: add VM_HUGETLB_HGM VMA flag From: James Houghton To: Mike Kravetz , Muchun Song , Peter Xu Cc: David Hildenbrand , David Rientjes , Axel Rasmussen , Mina Almasry , "Zach O'Keefe" , Manish Mishra , Naoya Horiguchi , "Dr . David Alan Gilbert" , "Matthew Wilcox (Oracle)" , Vlastimil Babka , Baolin Wang , Miaohe Lin , Yang Shi , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, James Houghton X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 1E2F0180007 X-Stat-Signature: yrhjb6hcdmpj9yfbno4rse39oy9e44r1 X-Rspam-User: X-HE-Tag: 1672913941-446025 X-HE-Meta: U2FsdGVkX1+6lzhfddxVcZ1dnrGYaqcPveGHzOtRRAWmf7wchF07uM3kn5HJb6aHWunA2xidFRPZ84gBUbPj3odUztiIXqNDXGMUZfwbVuoM6apkBIJv7jRDu98n0z8gRGNTruTpS3pymK3NzRtSZCsXeK+366jt1ncyLjYLae8CiAFupbkN0C8c5OdUNccvSN6ynIRXFiimzTASMWL6gVXKsMFj6+Zeb0rzA3UkKhvDXtPQyf/EM1SeTLKNYojCz3poyl+C0mVUOf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pzou/s8dZMuQWWFKzp/uoR7Ry3mBLalIpgLtZ04Vu9o0bBqAIf8yhZNHblc2x3JtyNGOVtBR39ygD 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: VM_HUGETLB_HGM indicates that a HugeTLB VMA may contain high-granularity mappings. Its VmFlags string is "hm". Signed-off-by: James Houghton --- fs/proc/task_mmu.c | 3 +++ include/linux/mm.h | 7 +++++++ include/trace/events/mmflags.h | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index e35a0398db63..41b5509bde0e 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c @@ -711,6 +711,9 @@ static void show_smap_vma_flags(struct seq_file *m, struct vm_area_struct *vma) #ifdef CONFIG_HAVE_ARCH_USERFAULTFD_MINOR [ilog2(VM_UFFD_MINOR)] = "ui", #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */ +#ifdef CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING + [ilog2(VM_HUGETLB_HGM)] = "hm", +#endif /* CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING */ }; size_t i; diff --git a/include/linux/mm.h b/include/linux/mm.h index c37f9330f14e..738b3605f80e 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -372,6 +372,13 @@ extern unsigned int kobjsize(const void *objp); # define VM_UFFD_MINOR VM_NONE #endif /* CONFIG_HAVE_ARCH_USERFAULTFD_MINOR */ +#ifdef CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING +# define VM_HUGETLB_HGM_BIT 38 +# define VM_HUGETLB_HGM BIT(VM_HUGETLB_HGM_BIT) /* HugeTLB high-granularity mapping */ +#else /* !CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING */ +# define VM_HUGETLB_HGM VM_NONE +#endif /* CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING */ + /* Bits set in the VMA until the stack is in its final location */ #define VM_STACK_INCOMPLETE_SETUP (VM_RAND_READ | VM_SEQ_READ) diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 412b5a46374c..88ce04b2ff69 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -163,6 +163,12 @@ IF_HAVE_PG_SKIP_KASAN_POISON(PG_skip_kasan_poison, "skip_kasan_poison") # define IF_HAVE_UFFD_MINOR(flag, name) #endif +#ifdef CONFIG_HUGETLB_HIGH_GRANULARITY_MAPPING +# define IF_HAVE_HUGETLB_HGM(flag, name) {flag, name}, +#else +# define IF_HAVE_HUGETLB_HGM(flag, name) +#endif + #define __def_vmaflag_names \ {VM_READ, "read" }, \ {VM_WRITE, "write" }, \ @@ -187,6 +193,7 @@ IF_HAVE_UFFD_MINOR(VM_UFFD_MINOR, "uffd_minor" ) \ {VM_ACCOUNT, "account" }, \ {VM_NORESERVE, "noreserve" }, \ {VM_HUGETLB, "hugetlb" }, \ +IF_HAVE_HUGETLB_HGM(VM_HUGETLB_HGM, "hugetlb_hgm" ) \ {VM_SYNC, "sync" }, \ __VM_ARCH_SPECIFIC_1 , \ {VM_WIPEONFORK, "wipeonfork" }, \