From patchwork Fri Oct 1 17:27:25 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 12531181 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 EDFA9C433FE for ; Fri, 1 Oct 2021 17:27:31 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 771146187D for ; Fri, 1 Oct 2021 17:27:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 771146187D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E263F94011B; Fri, 1 Oct 2021 13:27:30 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DD4AD9400E4; Fri, 1 Oct 2021 13:27:30 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC42094011B; Fri, 1 Oct 2021 13:27:30 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0061.hostedemail.com [216.40.44.61]) by kanga.kvack.org (Postfix) with ESMTP id BFE149400E4 for ; Fri, 1 Oct 2021 13:27:30 -0400 (EDT) Received: from smtpin01.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 71C9C39BA4 for ; Fri, 1 Oct 2021 17:27:30 +0000 (UTC) X-FDA: 78648550260.01.3B49209 Received: from mail-pj1-f46.google.com (mail-pj1-f46.google.com [209.85.216.46]) by imf02.hostedemail.com (Postfix) with ESMTP id 344727002C9B for ; Fri, 1 Oct 2021 17:27:30 +0000 (UTC) Received: by mail-pj1-f46.google.com with SMTP id oj16so3737519pjb.1 for ; Fri, 01 Oct 2021 10:27:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hRBnsHOhY3RkJJ55kOa8agH19+hjBWLoI6XvdfNnFos=; b=Xs8sPOBzwVsKgvPcUPiIaBbVcEdNF4tbxTxnktn84mfih9aV47w/so/YleDQRpQAJC /CnQ0q8FsP8iuXeeKHZvCHmNYJ1elS0RvFHMO8qFCQ2+Wvvob7KstVA6mNdT56h2JxQO 2EQ/LxBYwe24CZb5TPhKBLeMueOniJs8UV69c6BTFU8s23AD18pgmko8c6Aq39EvG1Sx 9qoV6CK4gt9OCuM/Gijdmi7B+fdWZm5GjA3DD+LQdb18/jwHp2o4fWASpcgMJsnWzbRH s3HqbwISyAlkqWvdSK4/34OC4fhzSGf9i0XpDnWOArFsLEFG1Yp9trTJiXLsOKDBo186 dOeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=hRBnsHOhY3RkJJ55kOa8agH19+hjBWLoI6XvdfNnFos=; b=1O4Go9K8r/C21tAlFU43xjXkRJ5QOjGPlYVZju6nyzLAePFngW5QBKbvJekW3bj7HG frY9qjpb4rNSQ1uKFiZE2ozeOXGBp2ffI8sT447fl8TAx6wNR801ojaimjc40gn2ua4/ AB2mFNLGJfAo2lYJ8/ObP0MTSOcMjz+8fAwAL0ZIRA6BsHYwe7/zo+xKDK25qTS9jq7T cbsWKTkKDUoNadZkPhEOxqsShQAfO1NTVyOR6G4ZpGg9po5I2tcQ4rKR4MeP9zTdIjBl Xm9KBLFXjp8aNgXwE6m/hWGmKFSHHbAE8x6h14nqyUHNgkRAdzMEa1WeGdQ5Y9XJ/a6K 8Ndg== X-Gm-Message-State: AOAM5310i1vU6MSGxv6pJHf9uuk+ZBeSHE9gUCJ0bUUHOKQeIppQC+sX FxwcO+wbvs2bdpHKcE0eOUE= X-Google-Smtp-Source: ABdhPJyyXeSOdt74N1gvq+sNdXSJlSUV655jdthXg4d5APRzI8ZT5khDmtWhi+G1pdDi+1VxrxM4qQ== X-Received: by 2002:a17:90a:e7ca:: with SMTP id kb10mr21097288pjb.33.1633109249113; Fri, 01 Oct 2021 10:27:29 -0700 (PDT) Received: from edumazet1.svl.corp.google.com ([2620:15c:2c4:201:63c:b112:55c:f7f4]) by smtp.gmail.com with ESMTPSA id w6sm7243589pfj.179.2021.10.01.10.27.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Oct 2021 10:27:28 -0700 (PDT) From: Eric Dumazet To: Andrew Morton Cc: linux-kernel , linux-mm , Eric Dumazet , Eric Dumazet Subject: [PATCH] mm/vmalloc: make show_numa_info() aware of hugepage mappings Date: Fri, 1 Oct 2021 10:27:25 -0700 Message-Id: <20211001172725.105824-1-eric.dumazet@gmail.com> X-Mailer: git-send-email 2.33.0.800.g4c38ced690-goog MIME-Version: 1.0 X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 344727002C9B X-Stat-Signature: 6andpp4qm3dannd3cp4nm5herm6ubhtg Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Xs8sPOBz; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf02.hostedemail.com: domain of eric.dumazet@gmail.com designates 209.85.216.46 as permitted sender) smtp.mailfrom=eric.dumazet@gmail.com X-HE-Tag: 1633109250-26794 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 show_numa_info() can be slightly faster, by skipping over hugepages directly. Signed-off-by: Eric Dumazet --- mm/vmalloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 42219f3d12b567fc64f54cd3e2f1e3398e261a2c..d51f5e1c95b4e01add8b952b6c5e2de2a1139e46 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -3853,6 +3853,7 @@ static void show_numa_info(struct seq_file *m, struct vm_struct *v) { if (IS_ENABLED(CONFIG_NUMA)) { unsigned int nr, *counters = m->private; + unsigned int step = 1U << vm_area_page_order(v); if (!counters) return; @@ -3864,9 +3865,8 @@ static void show_numa_info(struct seq_file *m, struct vm_struct *v) 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]);