All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Kravetz <mike.kravetz@oracle.com>
To: Rik van Riel <riel@surriel.com>
Cc: Edward Adam Davis <eadavis@qq.com>,
	akpm@linux-foundation.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, llvm@lists.linux.dev, muchun.song@linux.dev,
	nathan@kernel.org, ndesaulniers@google.com,
	syzbot+6ada951e7c0f7bc8a71e@syzkaller.appspotmail.com,
	syzkaller-bugs@googlegroups.com, trix@redhat.com
Subject: Re: [PATCH] mm/hugetlb: fix null ptr defer in hugetlb_vma_lock_write
Date: Thu, 2 Nov 2023 21:31:04 -0700	[thread overview]
Message-ID: <20231103043104.GA245368@monkey> (raw)
In-Reply-To: <48ec0dd17f048541dd83f7ed7cb29dac91d8c607.camel@surriel.com>

On 11/02/23 23:15, Rik van Riel wrote:
> On Thu, 2023-11-02 at 19:37 -0700, Mike Kravetz wrote:
> > On 11/02/23 19:24, Mike Kravetz wrote:
> > That qualification '(with resv_map)' caught my attention originally,
> > and
> > I thought about it again while looking into this.  We now cover the
> > common
> > cases, but there are still quite a few cases where resv_map is NULL
> > for
> > private mappings.  In such cases, the race between MADV_DONTNEED and
> > page
> > fault still exists.  Is that a concern?
> 
> Honestly, I'm not sure. In hugetlb_dup_vma_private, which is
> called at fork time, we have this comment:
> 
>          * - For MAP_PRIVATE mappings, this is the reserve map which
> does
>          *   not apply to children.  Faults generated by the children
> are
>          *   not guaranteed to succeed, even if read-only.
> 
> That suggests we already have no guarantee of faults
> succeeding after fork.

Right!

> 
> > 
> > With a bit more work we 'could' make sure every hugetlb vma has a
> > lock
> > to participate in this scheme.
> > 
> > Any thhoughts?
> 
> We can certainly close the race between MADV_DONTNEED
> and page faults for MAP_PRIVATE mappings in child processes,
> but that does not guarantee that we actually have hugetlb
> pages for those processes.
> 
> In short, I'm not sure :)

I sort of remember something Dave Hansen added years ago to help a customer
allocating LOTs of hugetlb pages dynamically.  I seem to recall that this
was to get better numa locality.  As a result, they did not use reservations.

I guess it sticks with me because it was/is a real example of a customer
choosing NOT to use reservations.  

I don't have any evidence that this is common.  My thought is to leave
it as is until someone complains.
-- 
Mike Kravetz

  reply	other threads:[~2023-11-03  4:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-29  9:27 [syzbot] [mm?] general protection fault in hugetlb_vma_lock_write syzbot
2023-10-31 18:38 ` Rik van Riel
2023-11-02 12:15   ` Aleksandr Nogikh
2023-11-01  6:36 ` [PATCH] mm/hugetlb: fix null ptr defer " Edward Adam Davis
2023-11-01 14:27   ` Rik van Riel
2023-11-02 12:58     ` Edward Adam Davis
2023-11-02 23:29       ` kernel test robot
2023-11-02 23:29       ` kernel test robot
2023-11-03  0:56       ` Rik van Riel
2023-11-03  1:26       ` kernel test robot
2023-11-03  2:24       ` Mike Kravetz
2023-11-03  2:28         ` Mike Kravetz
2023-11-03  2:37         ` Mike Kravetz
2023-11-03  3:15           ` Rik van Riel
2023-11-03  4:31             ` Mike Kravetz [this message]
2023-11-08  3:22       ` Mike Kravetz
2023-11-02 13:46     ` Yin, Fengwei

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=20231103043104.GA245368@monkey \
    --to=mike.kravetz@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=eadavis@qq.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=llvm@lists.linux.dev \
    --cc=muchun.song@linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=riel@surriel.com \
    --cc=syzbot+6ada951e7c0f7bc8a71e@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=trix@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.