From patchwork Sat Feb 18 00:27:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Houghton X-Patchwork-Id: 13145373 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 C051FC64ED8 for ; Sat, 18 Feb 2023 00:28:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 285B6280003; Fri, 17 Feb 2023 19:28:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 236E8280002; Fri, 17 Feb 2023 19:28:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 062D5280003; Fri, 17 Feb 2023 19:28:53 -0500 (EST) 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 EC70C280002 for ; Fri, 17 Feb 2023 19:28:52 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C0ABBA907B for ; Sat, 18 Feb 2023 00:28:52 +0000 (UTC) X-FDA: 80478527304.09.45C252E Received: from mail-yb1-f202.google.com (mail-yb1-f202.google.com [209.85.219.202]) by imf08.hostedemail.com (Postfix) with ESMTP id 0CB84160009 for ; Sat, 18 Feb 2023 00:28:50 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=L4T7D1Q7; spf=pass (imf08.hostedemail.com: domain of 3whvwYwoKCN8KUIPVHIUPOHPPHMF.DPNMJOVY-NNLWBDL.PSH@flex--jthoughton.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3whvwYwoKCN8KUIPVHIUPOHPPHMF.DPNMJOVY-NNLWBDL.PSH@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=1676680131; 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=Wk7vTpC+014vSbmA7BXLNrcppJOJiIEYznqCa6jfXqI=; b=I0AIcaL82+x1YILbpjEAHldV8oJklnoSTu9kMiiLkUQ4Uhd1g/YyNOIJ948vfNhKnaypLk ZoWuibD7dmrWOhD0lf6cKcqqyjoc2lbHqXJxKPC208a/NlRq8fCL48jvGMK0uz2xkWSLzo zvco7Kp8Jr28L4EU3JzeCdVrUFqlcbI= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=L4T7D1Q7; spf=pass (imf08.hostedemail.com: domain of 3whvwYwoKCN8KUIPVHIUPOHPPHMF.DPNMJOVY-NNLWBDL.PSH@flex--jthoughton.bounces.google.com designates 209.85.219.202 as permitted sender) smtp.mailfrom=3whvwYwoKCN8KUIPVHIUPOHPPHMF.DPNMJOVY-NNLWBDL.PSH@flex--jthoughton.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1676680131; a=rsa-sha256; cv=none; b=iX7vGLpXq8g+jAKy65OXTP/OivstkpCHCgOr+LBd1FG5wcRR1cAUjc2GnGL8ZSXLDpCwgs e6zRJjACEpziJ8GtR1KCVPaIGh5BqkYixNjq9TIN/e3rW1gF4fXlCFOwqEwPFxcYZLheU5 vkWJiLJxHxQgmmmyPO53UyxXvK1jBro= Received: by mail-yb1-f202.google.com with SMTP id 188-20020a2503c5000000b008e1de4c1e7dso2280834ybd.17 for ; Fri, 17 Feb 2023 16:28:50 -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=Wk7vTpC+014vSbmA7BXLNrcppJOJiIEYznqCa6jfXqI=; b=L4T7D1Q77q9QoOsnz1tm6Qf6BnOnAK2ZGTzjyBq232kdcaHnTPLu0KkbIFKg2iqZGi ur2eS2TG9FID8wSfSSNIUDRAH4/hc4cg6N78xCCSSvyxSCrRt7XxD8Kq9J+3/utwUlNa XwiHxLMwsKt54AmsMKUm23cdHK0jjFppi4B8oAiG6cdvRInp32jKLbSvstKyMXiqo8UK 07XHP/2+lJH0n/T1p+F0gJBrThd4SgIk1odXs4Xk0ZR7hodPP4o/xUlKaYBCidUzDuQ8 b+jdsTQykyqbj5MGq0jpb+xO5JrvhEf0KZUw8P19p8z3GR5sTSonXH6Em23ytW9e2DzL g/dQ== 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=Wk7vTpC+014vSbmA7BXLNrcppJOJiIEYznqCa6jfXqI=; b=PFmNVrHFRZ6p+GWJig3SfgCY598284r9jICxzdhd8EPsNIzTYXJCZNUhpK/zBM8POo /DN5UOEqiJaG5oxH5x/OMQTuWaozL/3ZZTimseLy3vYHP5lrYIfmIopG2W9rLTBAjvUc PVN7Kt1/DoDtNykVjvZs1qit65Je6bfC5VdXHAY4gduOhM54IeEfV1i4JF537xg9T7Y0 /nL45dJr5N15Zx3tNYy77rYW9pjPHaqPIUDP8SGMlH55ku27EPVJEcH6XQPZ8qc7jOki nUmDPzVsU88mTUmM2zDo8vXODj7SdDaa/QHIIzUqM02yjuQLg4UBvFGbJXwXgaXB69QX 3zVg== X-Gm-Message-State: AO0yUKVVQmdYxthmOI8cJn9UlcdPRvsAOkC0wu2O4ZbdN8tbNOTg/Opd xH31tk1o7DhFeqhMm4VmN/dn3/TMDuHo8rYN X-Google-Smtp-Source: AK7set9Co62mLp/e8p6CW/1K+ZyZaQWY5gSTbmZ9xHWOnSJaaxinPhJ3ofPuLxwknQEtxTaVNR5J+AVeIdAiLUtz X-Received: from jthoughton.c.googlers.com ([fda3:e722:ac3:cc00:14:4d90:c0a8:2a4f]) (user=jthoughton job=sendgmr) by 2002:a5b:4c3:0:b0:904:2aa2:c26c with SMTP id u3-20020a5b04c3000000b009042aa2c26cmr196573ybp.5.1676680130224; Fri, 17 Feb 2023 16:28:50 -0800 (PST) Date: Sat, 18 Feb 2023 00:27:40 +0000 In-Reply-To: <20230218002819.1486479-1-jthoughton@google.com> Mime-Version: 1.0 References: <20230218002819.1486479-1-jthoughton@google.com> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog Message-ID: <20230218002819.1486479-8-jthoughton@google.com> Subject: [PATCH v2 07/46] mm: add VM_HUGETLB_HGM VMA flag From: James Houghton To: Mike Kravetz , Muchun Song , Peter Xu , Andrew Morton 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 , Frank van der Linden , Jiaqi Yan , linux-mm@kvack.org, linux-kernel@vger.kernel.org, James Houghton X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 0CB84160009 X-Rspam-User: X-Stat-Signature: 8ftg3rmc4k5rdho8y798hksh6iwh33u8 X-HE-Tag: 1676680130-746573 X-HE-Meta: U2FsdGVkX184KzyVmd1G6QcmTLitjKOQYwiKMGWdPrFy9QpiVKieC4+0GmFohc9McMYGs3MZQuwkTRCGnL23QirZAAa1IDzRb+YsT/+W7ttOaGaLyHW5Sf8uXRSjAcUj8MHjg2cHvj3mzjoLFYh4X76CtZ4KbvkdoE+LUy6Tyd8Yv5D/kd//nDsuAKspKQYqA6ax6ExCP9Yvrgxn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1aEHBy7gCz1S71d4U4fPSVhk5DL/F+YWjUjFm0pMZZDf+HTQSfCiqNcgYZBk9wHtAnTEN7f6ySX3s+U1bFri/weJjdwdETeb3/aLOvZVxwRpi7TV2vnfX2dgkHlXx3bWWUDcyRBzz4aAIshThz1pXO+6AR7lkIY7FIdcStm8R5hwyIgL/6hCgVZN4Zfa7mj3QGGr34M5oPT2amUZBt3fePcARbBpL8D+TyiFCO4sHC7IY/vjrWNpSmD4PwoIcp2bP1vwnnNwf9RMjMhHJue09/QdgmKo77eEcn+HPXbL2UWyjyy01x4+ut67IIAOl3sKsHq+W+ZC8fYqLQ= 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 Acked-by: Mike Kravetz diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 6a96e1713fd5..77b72f42556a 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 2992a2d55aee..9d3216b4284a 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h @@ -383,6 +383,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 9db52bc4ce19..bceb960dbada 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -162,6 +162,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" }, \ @@ -186,6 +192,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" }, \