From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 05003C433ED for ; Thu, 15 Apr 2021 23:29:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8EF3961152 for ; Thu, 15 Apr 2021 23:29:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8EF3961152 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=axtens.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 1FCBC6B0071; Thu, 15 Apr 2021 19:29:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1D46C6B0072; Thu, 15 Apr 2021 19:29:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 04D596B0073; Thu, 15 Apr 2021 19:29:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0235.hostedemail.com [216.40.44.235]) by kanga.kvack.org (Postfix) with ESMTP id D91CF6B0071 for ; Thu, 15 Apr 2021 19:29:25 -0400 (EDT) Received: from smtpin10.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 8925E1837AE74 for ; Thu, 15 Apr 2021 23:29:25 +0000 (UTC) X-FDA: 78036195090.10.DFA3A28 Received: from mail-pj1-f52.google.com (mail-pj1-f52.google.com [209.85.216.52]) by imf19.hostedemail.com (Postfix) with ESMTP id ED7E290009F8 for ; Thu, 15 Apr 2021 23:29:07 +0000 (UTC) Received: by mail-pj1-f52.google.com with SMTP id q14-20020a17090a430eb02901503aaee02bso2523179pjg.3 for ; Thu, 15 Apr 2021 16:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=jw2PSbrXAEN39rMTtQwepRsUrzSF/PJDp6qJKD1maOQ=; b=Fni1JOOo4PrUzlzK7TjMF4v5KQ8JMEB8GQFvJdoCIs85gQ7hkEMknpG3xaXPhS80Fg xJbRmZBxuaLCaLsDL4AVpD5/12galNW2GkHBhD13nBI/qZ+kzKtFLFCZKRtePFqUO/Re Zz++4+ACyGOOamm7Y7acj4xF6H4JSsTKL7jUc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=jw2PSbrXAEN39rMTtQwepRsUrzSF/PJDp6qJKD1maOQ=; b=nqbJ/1/9Xr1ETtcoi1glGs7fIHZg4cgDaRlUfGgVwKVKiusvJ/WFXvvnjQZZwt4/AU Ng9mPlRHyvndvRR0R502LamIqeVvAD208oT/+X/lyDFzZgqKMSTaRTJTDYbH5PrpjCAO GTAwKohg4Fj0dMR8+4veUmh3jDw4YQVOsjBYmqYTy9/+HvWpan9E61e6pdbifAocMl4e hUiq0xlkvFpOUgHmk4TooXc1pT4JqGP8x6wcr8IqeGb35idG3f2r0pQFGRCkaJwnGDfG 1IxMP+FZsFR8+gwRZQSpxdjg0iJQE4qnF8EVZgmtc7fnViN7cZqWktohqUOtYqnIyrrS wJnQ== X-Gm-Message-State: AOAM531mljB8GsVRSJElbBSKaEL0+25og/VDsdzoPWGUREqRA0BomIn6 WPiS9GkIeGt0eA0b5KwiO4qFHg== X-Google-Smtp-Source: ABdhPJxSv6iVBSeJJdGrfMFvazb0EusrLGidlTGj83XpU/NnbzX7T+WOwAI5+RKJlavNfX48j0XS8Q== X-Received: by 2002:a17:90a:6c88:: with SMTP id y8mr6713418pjj.38.1618529364161; Thu, 15 Apr 2021 16:29:24 -0700 (PDT) Received: from localhost (2001-44b8-111e-5c00-3f8b-a64e-9a27-b872.static.ipv6.internode.on.net. [2001:44b8:111e:5c00:3f8b:a64e:9a27:b872]) by smtp.gmail.com with ESMTPSA id nv7sm3342006pjb.18.2021.04.15.16.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Apr 2021 16:29:23 -0700 (PDT) From: Daniel Axtens To: Christophe Leroy , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Steven Price , akpm@linux-foundation.org Cc: linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, x86@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v1 4/5] mm: ptdump: Support hugepd table entries In-Reply-To: References: Date: Fri, 16 Apr 2021 09:29:20 +1000 Message-ID: <87zgxzyvn3.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 Content-Type: text/plain X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: ED7E290009F8 X-Stat-Signature: jwunmadpyn76cp3uumsufc1g3c4f476j Received-SPF: none (axtens.net>: No applicable sender policy available) receiver=imf19; identity=mailfrom; envelope-from=""; helo=mail-pj1-f52.google.com; client-ip=209.85.216.52 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1618529347-79762 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: Hi Christophe, > Which hugepd, page table entries can be at any level > and can be of any size. > > Add support for them. > > Signed-off-by: Christophe Leroy > --- > mm/ptdump.c | 17 +++++++++++++++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/mm/ptdump.c b/mm/ptdump.c > index 61cd16afb1c8..6efdb8c15a7d 100644 > --- a/mm/ptdump.c > +++ b/mm/ptdump.c > @@ -112,11 +112,24 @@ static int ptdump_pte_entry(pte_t *pte, unsigned long addr, > { > struct ptdump_state *st = walk->private; > pte_t val = ptep_get(pte); > + unsigned long page_size = next - addr; > + int level; > + > + if (page_size >= PGDIR_SIZE) > + level = 0; > + else if (page_size >= P4D_SIZE) > + level = 1; > + else if (page_size >= PUD_SIZE) > + level = 2; > + else if (page_size >= PMD_SIZE) > + level = 3; > + else > + level = 4; > > if (st->effective_prot) > - st->effective_prot(st, 4, pte_val(val)); > + st->effective_prot(st, level, pte_val(val)); > > - st->note_page(st, addr, 4, pte_val(val), PAGE_SIZE); > + st->note_page(st, addr, level, pte_val(val), page_size); It seems to me that passing both level and page_size is a bit redundant, but I guess it does reduce the impact on each arch's code? Kind regards, Daniel > > return 0; > } > -- > 2.25.0