linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
Cc: Linux-MM <linux-mm@kvack.org>, Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/2] mm: Change pud_page_vaddr to return pmd_t *
Date: Mon, 14 Jun 2021 11:32:05 -0700	[thread overview]
Message-ID: <CAHk-=wgo4f7XX--Mifz_xEBHPi8qFSN4KSLMtT6ZKKUtwPAPiw@mail.gmail.com> (raw)
In-Reply-To: <30cdb642-4419-a43f-0dbc-613e74a09338@linux.ibm.com>

On Mon, Jun 14, 2021 at 4:30 AM Aneesh Kumar K.V
<aneesh.kumar@linux.ibm.com> wrote:
>
> while we are doing this, should we rename pud_page_vaddr to pud_pgtable
> and p4d_page_vaddr to p4d_pgtable? I actually find the name
> pud_page_vaddr confusing (is it the vaddr of pud page kind of confusion)

I agree. The "vaddr" thing is only confusing - I think it was there
exactly _because_ the return type was so odd, and because of
historical implementation.

IOW it was probably mostly due to the implementation issue of "we use
__va() to generate the virtual address from a physical address that
exists the page tables", and then that internal implementation thing
because part of the naming because there was no conceptually good name
for it.

Now that it literally returns a pointer to a pmd_t, I think the
"vaddr" is just a pointless and silly name - *of*course* it's a
virtual address, it's a pointer! And it would be much more logical to
say that it returns the (pmd-level) pgtable pointer of the pud entry,
so yeah, "pud_pgtable()" seems conceptually fairly sensible to me.

It's probably a good idea to do the "rename and change type" in one
single patch. Not just because it changes the exact same lines, but
because the whole "pick a new name when changing semantics" is
generally a good idea in that it also makes compiler errors more
obvious - type changes can otherwise be hidden by explicit casts etc.

            Linus


      reply	other threads:[~2021-06-14 18:32 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-14 11:02 Aneesh Kumar K.V
2021-06-14 11:02 ` [PATCH 2/2] mm: Change p4d_page_vaddr to return pud_t * Aneesh Kumar K.V
2021-07-01  2:08   ` [mm] c0af5203b9: will-it-scale.per_process_ops 7.4% improvement kernel test robot
2021-06-14 11:30 ` [PATCH 1/2] mm: Change pud_page_vaddr to return pmd_t * Aneesh Kumar K.V
2021-06-14 18:32   ` Linus Torvalds [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHk-=wgo4f7XX--Mifz_xEBHPi8qFSN4KSLMtT6ZKKUtwPAPiw@mail.gmail.com' \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox