From patchwork Mon Sep 28 17:54:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zi Yan X-Patchwork-Id: 11804493 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E657A618 for ; Mon, 28 Sep 2020 17:56:33 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AA47B22204 for ; Mon, 28 Sep 2020 17:56:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=sent.com header.i=@sent.com header.b="bqH0Bi6P"; dkim=temperror (0-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="OK7wJUb5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AA47B22204 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=sent.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9C25390001D; Mon, 28 Sep 2020 13:55:31 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 9975090001A; Mon, 28 Sep 2020 13:55:31 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8398990001E; Mon, 28 Sep 2020 13:55:31 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0179.hostedemail.com [216.40.44.179]) by kanga.kvack.org (Postfix) with ESMTP id 6DB1690001D for ; Mon, 28 Sep 2020 13:55:31 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 2FDE2181AE86D for ; Mon, 28 Sep 2020 17:55:31 +0000 (UTC) X-FDA: 77313222462.12.joke31_461513227183 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 06D8D1805408D for ; Mon, 28 Sep 2020 17:55:30 +0000 (UTC) X-Spam-Summary: 1,0,0,e0b3fcd8f3cbd515,d41d8cd98f00b204,zi.yan@sent.com,,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1261:1311:1314:1345:1359:1437:1515:1535:1541:1711:1730:1747:1777:1792:1801:2393:2553:2559:2562:2693:2901:3138:3139:3140:3141:3142:3352:3865:3866:3867:3868:3870:3871:3872:4117:4321:4605:5007:6119:6120:6261:6653:6742:7576:7901:8603:10004:10903:11026:11232:11473:11657:11658:11914:12043:12296:12438:12555:12679:12895:12986:13069:13311:13357:13894:14181:14384:14581:14721:21080:21627:21795:21990:30051:30054:30056:30064:30090,0,RBL:64.147.123.17:@sent.com:.lbl8.mailshell.net-64.100.201.100 62.18.0.100;04yrdbiok1f8oi9g11pzdpjccm9bbyp7md9peuh51djn6hx43x7o5rs9w7eicjq.cru1rrj97bac8qtwtyowh7gpxx9gq86or4rcnd8qndirhi4whjx6kejdx7da5ps.w-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:27,LUA_SUMMARY:none X-HE-Tag: joke31_461513227183 X-Filterd-Recvd-Size: 6070 Received: from wnew3-smtp.messagingengine.com (wnew3-smtp.messagingengine.com [64.147.123.17]) by imf44.hostedemail.com (Postfix) with ESMTP for ; Mon, 28 Sep 2020 17:55:30 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 875AFE7E; Mon, 28 Sep 2020 13:55:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 28 Sep 2020 13:55:29 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sent.com; h=from :to:cc:subject:date:message-id:in-reply-to:references:reply-to :mime-version:content-transfer-encoding; s=fm1; bh=hEDfPgaD0F1Ir Gg16yzXHXns+J50v05ddCe9x/z5XhY=; b=bqH0Bi6Pd970v1YMJbeVN95QTRqME aldJWGE6nstMyTGKIMSyKYimhbyFk7WMzI7vCdR8PdVq0PicpFSustr4hZluwT06 CGjolCRuoWo4KLxCp61sy+TocJr55EjF2Hd5xIYj6hGyHxScwTwixkJmM5KotHMT +BvfQo3OwWd5RCdzkiqqsDLz9833zLZFkaO2wctsD7KXQzo0DOWEjUn6/QVKTKt4 9EadzdhIQxAiHU9TrefdMSjAVgraKQ+4zCNH2Tvq/CHZfWrg6BHOrRRaRGsTdmOs 75EXkC2YZ1JD/d4M6gj0BNmgWB+1ll2C6gWN4JvUN0Bt1j5R9ejkHtCng== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:reply-to:subject :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=hEDfPgaD0F1IrGg16yzXHXns+J50v05ddCe9x/z5XhY=; b=OK7wJUb5 P6iKo/6Sh7RSJTZp9j4cEOt8OWrjc7IEw2eS+nqU5Dhs0vP34uu6WQ0UAIEW6oWK JbM8PByEmH3TM1N1VHJCP3q+svIFLcGctbECZr2kUdT5Oim5pT8bsjFxIk8PO6Ru Pswwd90kxdBEYcmS+bW/uUUJlN8JCkhowhTmqK9xdFNQ58Bf+Wx6Owe4rUkV9dBO qmLn11tFo4dxgQYh5azhsybW395xB5vEnqRhvU2JXI8TA2kbaa6UyPvxVvgPpVzk SthMtmmzeS9tQZYPJJQjjxZ497WHtp6C1DUapLbkXwUdCyxvQtjbVJEnpJHg4LI3 e0YDPIRVDotUeQ== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrvdeigdeliecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvffufffkofgjfhhrggfgsedtkeertdertddtnecuhfhrohhmpegkihcujggr nhcuoeiiihdrhigrnhesshgvnhhtrdgtohhmqeenucggtffrrghtthgvrhhnpeduhfffve ektdduhfdutdfgtdekkedvhfetuedufedtgffgvdevleehheevjefgtdenucfkphepuddv rdegiedruddtiedrudeigeenucevlhhushhtvghrufhiiigvpeduvdenucfrrghrrghmpe hmrghilhhfrhhomhepiihirdihrghnsehsvghnthdrtghomh X-ME-Proxy: Received: from nvrsysarch6.NVidia.COM (unknown [12.46.106.164]) by mail.messagingengine.com (Postfix) with ESMTPA id A13CB3064688; Mon, 28 Sep 2020 13:55:27 -0400 (EDT) From: Zi Yan To: linux-mm@kvack.org Cc: "Kirill A . Shutemov" , Roman Gushchin , Rik van Riel , Matthew Wilcox , Shakeel Butt , Yang Shi , Jason Gunthorpe , Mike Kravetz , Michal Hocko , David Hildenbrand , William Kucharski , Andrea Arcangeli , John Hubbard , David Nellans , linux-kernel@vger.kernel.org, Zi Yan Subject: [RFC PATCH v2 27/30] mm: thp: make PUD THP size public. Date: Mon, 28 Sep 2020 13:54:25 -0400 Message-Id: <20200928175428.4110504-28-zi.yan@sent.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200928175428.4110504-1-zi.yan@sent.com> References: <20200928175428.4110504-1-zi.yan@sent.com> Reply-To: Zi Yan MIME-Version: 1.0 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: From: Zi Yan User can access the PUD THP size via `cat /sys/kernel/mm/transparent_hugepage/hpage_pud_size`. This is similar to make PMD THP size public. Signed-off-by: Zi Yan --- Documentation/admin-guide/mm/transhuge.rst | 1 + mm/huge_memory.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/Documentation/admin-guide/mm/transhuge.rst b/Documentation/admin-guide/mm/transhuge.rst index b2acd0d395ca..11b173c2650e 100644 --- a/Documentation/admin-guide/mm/transhuge.rst +++ b/Documentation/admin-guide/mm/transhuge.rst @@ -159,6 +159,7 @@ Some userspace (such as a test program, or an optimized memory allocation library) may want to know the size (in bytes) of a transparent hugepage:: cat /sys/kernel/mm/transparent_hugepage/hpage_pmd_size + cat /sys/kernel/mm/transparent_hugepage/hpage_pud_size khugepaged will be automatically started when transparent_hugepage/enabled is set to "always" or "madvise, and it'll diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 1965753b31a2..20ecffc27396 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -340,12 +340,25 @@ static ssize_t hpage_pmd_size_show(struct kobject *kobj, static struct kobj_attribute hpage_pmd_size_attr = __ATTR_RO(hpage_pmd_size); +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD +static ssize_t hpage_pud_size_show(struct kobject *kobj, + struct kobj_attribute *attr, char *buf) +{ + return sprintf(buf, "%lu\n", HPAGE_PUD_SIZE); +} +static struct kobj_attribute hpage_pud_size_attr = + __ATTR_RO(hpage_pud_size); +#endif + static struct attribute *hugepage_attr[] = { &enabled_attr.attr, &enabled_pud_thp_attr.attr, &defrag_attr.attr, &use_zero_page_attr.attr, &hpage_pmd_size_attr.attr, +#ifdef CONFIG_HAVE_ARCH_TRANSPARENT_HUGEPAGE_PUD + &hpage_pud_size_attr.attr, +#endif #ifdef CONFIG_SHMEM &shmem_enabled_attr.attr, #endif