From: Matthew Wilcox <willy@infradead.org>
To: Ben Wolsieffer <ben.wolsieffer@hefring.com>,
David Howells <dhowells@redhat.com>
Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
Vlastimil Babka <vbabka@suse.cz>,
"Liam R. Howlett" <Liam.Howlett@oracle.com>,
Andrew Morton <akpm@linux-foundation.org>,
Oleg Nesterov <oleg@redhat.com>,
Giulio Benetti <giulio.benetti@benettiengineering.com>,
Davidlohr Bueso <dave@stgolabs.net>
Subject: Re: [PATCH] proc: nommu: fix empty /proc/<pid>/maps
Date: Fri, 15 Sep 2023 18:18:21 +0100 [thread overview]
Message-ID: <ZQSR3W9WKBbs5JSr@casper.infradead.org> (raw)
In-Reply-To: <20230915160055.971059-2-ben.wolsieffer@hefring.com>
On Fri, Sep 15, 2023 at 12:00:56PM -0400, Ben Wolsieffer wrote:
> On no-MMU, /proc/<pid>/maps reads as an empty file. This happens because
> find_vma(mm, 0) always returns NULL (assuming no vma actually contains
> the zero address, which is normally the case).
Your patch is correct, but this is a deeper problem. find_vma() on
MMU architectures returns the first VMA which is >= addr.
* Returns: The VMA associated with addr, or the next VMA.
* May return %NULL in the case of no VMA at addr or above.
But that's not how find_vma() behaves on nommu! And I'd be tempted to
blame the maple tree conversion, but this is how it looked before the
maple tree:
- /* trawl the list (there may be multiple mappings in which addr
- * resides) */
- for (vma = mm->mmap; vma; vma = vma->vm_next) {
- if (vma->vm_start > addr)
- return NULL;
- if (vma->vm_end > addr) {
- vmacache_update(addr, vma);
- return vma;
- }
- }
So calling find_vma(0) always returned NULL. Unless there was a VMA
at 0, which there probably wasn't.
Why does nommu behave differently? Dave, you introduced it back in 2005
(yes, I had to go to the git history tree for this one)
prev parent reply other threads:[~2023-09-15 17:21 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-15 16:00 Ben Wolsieffer
2023-09-15 17:10 ` Liam R. Howlett
2023-09-15 17:18 ` Matthew Wilcox [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=ZQSR3W9WKBbs5JSr@casper.infradead.org \
--to=willy@infradead.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=ben.wolsieffer@hefring.com \
--cc=dave@stgolabs.net \
--cc=dhowells@redhat.com \
--cc=giulio.benetti@benettiengineering.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=vbabka@suse.cz \
/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
all inboxes | Powered by JetHome®