From patchwork Fri Nov 5 20:39:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12605545 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 07485C433EF for ; Fri, 5 Nov 2021 20:39:28 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B21CC6056B for ; Fri, 5 Nov 2021 20:39:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B21CC6056B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 57077940057; Fri, 5 Nov 2021 16:39:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4D14E940049; Fri, 5 Nov 2021 16:39:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 34A5A940057; Fri, 5 Nov 2021 16:39:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0254.hostedemail.com [216.40.44.254]) by kanga.kvack.org (Postfix) with ESMTP id 26598940049 for ; Fri, 5 Nov 2021 16:39:27 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DED6018352D2C for ; Fri, 5 Nov 2021 20:39:26 +0000 (UTC) X-FDA: 78776042016.01.FB8A987 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf11.hostedemail.com (Postfix) with ESMTP id 8D076F0000AE for ; Fri, 5 Nov 2021 20:39:26 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id A57F560FBF; Fri, 5 Nov 2021 20:39:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1636144765; bh=XIZU7H+XkC2VvekaNszqpL0dVHiRIrj4XkVzD6+V0uA=; h=Date:From:To:Subject:In-Reply-To:From; b=gV2z0ikWBROu0+0dL7EHYZxxbMihigUrZdbrbmxMjLRNhuyrNCv2mfim8HcIdeuch NMODOEkXsuNnBU2H7073bbMgVyPvVt3poru0pScf+TrMTjAvmX7moBkgkuFODPhk09 GFtOuCv526ojlo3iXia64hIuRcswBh9ChTMgfjmE= Date: Fri, 05 Nov 2021 13:39:25 -0700 From: Andrew Morton To: akpm@linux-foundation.org, edumazet@google.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, torvalds@linux-foundation.org, urezki@gmail.com Subject: [patch 091/262] mm/vmalloc: make show_numa_info() aware of hugepage mappings Message-ID: <20211105203925.w8uD6f-BW%akpm@linux-foundation.org> In-Reply-To: <20211105133408.cccbb98b71a77d5e8430aba1@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=gV2z0ikW; dmarc=none; spf=pass (imf11.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 8D076F0000AE X-Stat-Signature: 9bsysfj8buba6azxd5daq8mxgpgfjrxb X-HE-Tag: 1636144766-912216 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: Eric Dumazet Subject: mm/vmalloc: make show_numa_info() aware of hugepage mappings show_numa_info() can be slightly faster, by skipping over hugepages directly. Link: https://lkml.kernel.org/r/20211001172725.105824-1-eric.dumazet@gmail.com Signed-off-by: Eric Dumazet Cc: Uladzislau Rezki (Sony) Signed-off-by: Andrew Morton --- mm/vmalloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/mm/vmalloc.c~mm-vmalloc-make-show_numa_info-aware-of-hugepage-mappings +++ a/mm/vmalloc.c @@ -3864,6 +3864,7 @@ static void show_numa_info(struct seq_fi { if (IS_ENABLED(CONFIG_NUMA)) { unsigned int nr, *counters = m->private; + unsigned int step = 1U << vm_area_page_order(v); if (!counters) return; @@ -3875,9 +3876,8 @@ static void show_numa_info(struct seq_fi memset(counters, 0, nr_node_ids * sizeof(unsigned int)); - for (nr = 0; nr < v->nr_pages; nr++) - counters[page_to_nid(v->pages[nr])]++; - + for (nr = 0; nr < v->nr_pages; nr += step) + counters[page_to_nid(v->pages[nr])] += step; for_each_node_state(nr, N_HIGH_MEMORY) if (counters[nr]) seq_printf(m, " N%u=%u", nr, counters[nr]);