linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Peter Xu <peterx@redhat.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: akpm@linux-foundation.org, willy@infradead.org,
	hannes@cmpxchg.org, mhocko@suse.com, josef@toxicpanda.com,
	jack@suse.cz, ldufour@linux.ibm.com, laurent.dufour@fr.ibm.com,
	michel@lespinasse.org, liam.howlett@oracle.com,
	jglisse@google.com, vbabka@suse.cz, minchan@google.com,
	dave@stgolabs.net, punit.agrawal@bytedance.com,
	lstoakes@gmail.com, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, kernel-team@android.com
Subject: Re: [PATCH v2 1/1] mm: do not increment pgfault stats when page fault handler retries
Date: Tue, 18 Apr 2023 11:19:40 -0400	[thread overview]
Message-ID: <ZD61DLJNilUeDCnC@x1n> (raw)
In-Reply-To: <CAJuCfpHf06cr2d277DXQUtBto_0bVgK3ykMHLYRgZXgnot=e4w@mail.gmail.com>

On Mon, Apr 17, 2023 at 03:47:57PM -0700, Suren Baghdasaryan wrote:
> On Mon, Apr 17, 2023 at 2:26 PM Peter Xu <peterx@redhat.com> wrote:
> >
> > On Fri, Apr 14, 2023 at 05:08:18PM -0700, Suren Baghdasaryan wrote:
> > > @@ -5223,8 +5230,8 @@ vm_fault_t handle_mm_fault(struct vm_area_struct *vma, unsigned long address,
> > >               if (task_in_memcg_oom(current) && !(ret & VM_FAULT_OOM))
> > >                       mem_cgroup_oom_synchronize(false);
> > >       }
> > > -
> > > -     mm_account_fault(regs, address, flags, ret);
> > > +out:
> > > +     mm_account_fault(mm, regs, address, flags, ret);
> >
> > Ah, one more question.. can this cached mm race with a destroying mm (just
> > like the vma race we wanted to avoid)?  Still a question only applies to
> > COMPLETE case when mmap read lock can be released.  Thanks,
> 
> I believe that is impossible because whoever is calling the page fault
> handler has stabilized the mm by getting a refcount.

Do you have a hint on where that refcount is taken?

Btw, it's definitely not a question sololy for this patch but a more common
question to the page fault path.  It's just that when I wanted to look for
any refcount boost (which I also expect to have somewhere) I didn't really
see that in current path (e.g. do_user_addr_fault() for x86_64).

I also had a quick look on do_exit() but I also didn't see where do we
e.g. wait for all the threads to stop before recycles a mm.

I had a feeling that I must have missed something, but just want to make
sure it's the case.

-- 
Peter Xu



  reply	other threads:[~2023-04-18 15:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-15  0:08 Suren Baghdasaryan
2023-04-17 17:26 ` Matthew Wilcox
2023-04-17 19:40 ` Peter Xu
2023-04-17 20:29   ` Suren Baghdasaryan
2023-04-17 21:14     ` Peter Xu
2023-04-17 21:21       ` Suren Baghdasaryan
2023-04-17 22:52   ` Matthew Wilcox
2023-04-17 23:17     ` Suren Baghdasaryan
2023-04-18 14:25       ` Matthew Wilcox
2023-04-18 14:54         ` Suren Baghdasaryan
2023-04-18 15:08           ` Matthew Wilcox
2023-04-18 16:06             ` Peter Xu
2023-04-18 17:17               ` Suren Baghdasaryan
2023-04-18 21:48                 ` Suren Baghdasaryan
2023-04-18 22:45                   ` Peter Xu
2023-04-18 22:58                     ` Suren Baghdasaryan
2023-04-18 23:38                       ` Peter Xu
2023-04-19 18:00                         ` Suren Baghdasaryan
2023-04-17 21:26 ` Peter Xu
2023-04-17 22:47   ` Suren Baghdasaryan
2023-04-18 15:19     ` Peter Xu [this message]
2023-04-18 15:32       ` Matthew Wilcox
2023-04-18 15:48         ` Peter Xu
2023-04-18 16:45           ` Suren Baghdasaryan
2023-04-18 18:46             ` Peter Xu

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=ZD61DLJNilUeDCnC@x1n \
    --to=peterx@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=dave@stgolabs.net \
    --cc=hannes@cmpxchg.org \
    --cc=jack@suse.cz \
    --cc=jglisse@google.com \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@android.com \
    --cc=laurent.dufour@fr.ibm.com \
    --cc=ldufour@linux.ibm.com \
    --cc=liam.howlett@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lstoakes@gmail.com \
    --cc=mhocko@suse.com \
    --cc=michel@lespinasse.org \
    --cc=minchan@google.com \
    --cc=punit.agrawal@bytedance.com \
    --cc=surenb@google.com \
    --cc=vbabka@suse.cz \
    --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