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: 58813 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp142253wrn; Fri, 17 Feb 2023 16:30:13 -0800 (PST) X-Google-Smtp-Source: AK7set+wy6xk+FzpA1XWAALXT7Ts5b0Qyrxw/1fVLvFQBfkYMF4ZMqDpdoLeyFE5FsG2lFwY6zGb X-Received: by 2002:a17:906:8042:b0:8b1:788f:2198 with SMTP id x2-20020a170906804200b008b1788f2198mr5772102ejw.19.1676680213125; Fri, 17 Feb 2023 16:30:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676680213; cv=none; d=google.com; s=arc-20160816; b=urP6f3PoGgazhhMklWGTyJ1gc3wgpIn5nZhoS0YGvfl/ZSoW8+2g0l4WlgVb9xG6Ca JM97RpsNKwJCSBoVYl6x6/nQKm4MbzY9H9W0DpH5qkWRsqjgHm1f2T2pTN7gJC0Mas2n MUFWvyj0S8I2Wjqu73f8WSQz5xFkW8yiDE+yq++zuk99SWE9gkGNz2IoGjFnxwRD0p9L YbWugWbLJ2LLxHiXtrFMTj/1NDLt2flVH6cvSXM057QhMMq+1u6kch9qdGD97KdKyK8h pc006Au8SUqtW5rVRKcebIOhhB1LcGOi1zC50VoG9JecuIgqs55yWVOsPvkI9XFNgSEs uvUQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=Wk7vTpC+014vSbmA7BXLNrcppJOJiIEYznqCa6jfXqI=; b=sA60QC23/95Dqw9S0Y7Vu4mdnhyU9Jf+jOiXAOo1qOf4sUiWjcncod7BUOXnsK2BEV 4Pix+bpWYXCKpIjcYIz94QTbnF8VHan1E9sOyZIHSdxuEIA0q6q/pihM6QKO0LE4lFYF KbBkMeWu6/zt4EavCBuHBIqBB+Cb5RQzkb+k5VtNwuLUbjVxv8rp6j2Ldt+pH5naS/Tr IgLN+KlHpbE2Dw3gMSb521vVey6VyOGqjoryOjx4dJ9IuWOe8k0GCE8YRRcUxM+Rx5yS eAyct8pA6O8EwmSehKGBm8b/fPSCWdalQDUDLT7T68uAfdglaD/UF6+BK0+3kb8MNWq2 /mDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=L4T7D1Q7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 18-20020a170906011200b008b1785971e2si5590063eje.33.2023.02.17.16.29.49; Fri, 17 Feb 2023 16:30:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=L4T7D1Q7; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230052AbjBRA3I (ORCPT + 99 others); Fri, 17 Feb 2023 19:29:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229903AbjBRA2v (ORCPT ); Fri, 17 Feb 2023 19:28:51 -0500 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6C6D68AD1 for ; Fri, 17 Feb 2023 16:28:50 -0800 (PST) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-536582abb72so22511017b3.5 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=VU/kYh2YLkc4Pgq3AXqOM48MzXWsWoCVL3Y4iPPyZDykghSyXb4IQO7TH5X7u+jom6 jurRhl+ucqR7oxsZAASoea47zGOuBU+D7WfNJf4nrF1H2pKxpFvT2LUlY97y1arTJsMG uvObI/VHKzvHKpavYhRsZwVl4gSicaalsiUyVayp7lfJQuRzdHpqnwjKleU7MMyAyY5l AL2YI2vX1/jNC1JZl5BJQ9MFh6Vn1Ez5FgaxR9mOPyDUCXuRu7kAtghKJKAJq6HSCLfT BP6xNO9/fX17eVby/mntmUwOaqxze+6ik94m2KrKbNxJdt5+GDIoCMt7nU4G8uAr5KXo INRA== X-Gm-Message-State: AO0yUKVhn3hRpRdPGX6T/iskMO6hWI340N9wrX1HaFYN8U74nQYY4tsz f+zEWSL+WUQnTA2WSGwWUGZNQ5egBYE3Nb3G 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-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758126631095475967?= X-GMAIL-MSGID: =?utf-8?q?1758126631095475967?= 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" }, \