linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Lukas Bulwahn <lukas.bulwahn@gmail.com>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	"Liam R. Howlett" <Liam.Howlett@oracle.com>,
	 "maple-tree@lists.infradead.org"
	<maple-tree@lists.infradead.org>
Cc: Linux-MM <linux-mm@kvack.org>,
	 Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	 kernel-janitors <kernel-janitors@vger.kernel.org>
Subject: Issue in count_mm_mlocked_page_nr() with commit afcf76df48f9 ("mm/mlock: use vma iterator and maple state instead of vma linked list")
Date: Tue, 14 Jun 2022 13:29:59 +0200	[thread overview]
Message-ID: <CAKXUXMxJjcmhkNYmS0DO0DqeQK09wcY6b_Nu0fb-0BMZfN0XyA@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 1165 bytes --]

Dear Matthew, dear Liam,

The commit afcf76df48f9 ("mm/mlock: use vma iterator and maple state instead
of vma linked list") refactors the function count_mm_mlocked_page_nr() in
mm/mlock.c, such that the special case:

        if (mm == NULL)
                mm = current->mm;

is now dead code. Before the refactoring, after this if statement, the
variable
mm was used further in vma = find_vma(mm, start) in the following line, but
now,
with the introduction of VMA_ITERATOR(vmi, mm, start) before the if
statement,
the assignment within the if statement is simply ignored.

I assume that:
- If the semantics of this function shall be preserved, the VMA_ITERATOR
macro
needs to move after the if statement.

- or, if the consideration of the special case on mm == NULL is actually
obsolete with this refactoring, it could be simply deleted.

I will keep it up to you how this issue is correctly resolved.

This was discovered due to tracking all dead stores that clang-analyzer
reports
on an x86 defconfig. The underlying issue here is more severe than "just a
dead
store in the kernel code base", but it is probably easy for you to resolve.

Best regards,

Lukas

[-- Attachment #2: Type: text/html, Size: 1331 bytes --]

             reply	other threads:[~2022-06-14 11:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 11:29 Lukas Bulwahn [this message]
2022-06-14 11:33 Lukas Bulwahn
2022-06-15 15:01 ` Liam Howlett

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=CAKXUXMxJjcmhkNYmS0DO0DqeQK09wcY6b_Nu0fb-0BMZfN0XyA@mail.gmail.com \
    --to=lukas.bulwahn@gmail.com \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=maple-tree@lists.infradead.org \
    --cc=willy@infradead.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