Linux-mm Archive mirror
 help / color / mirror / Atom feed
From: "Liam R. Howlett" <Liam.Howlett@oracle.com>
To: Suren Baghdasaryan <surenb@google.com>
Cc: Matthew Wilcox <willy@infradead.org>,
	linux-mm@kvack.org, netdev@vger.kernel.org,
	Arjun Roy <arjunroy@google.com>
Subject: Re: [RFC] Make find_tcp_vma() more efficient
Date: Tue, 14 May 2024 18:12:26 -0400	[thread overview]
Message-ID: <l3abhimtyv24oogb5l2is7hml6fcs6vlthbd7n4rmnyou24e5l@capndvics4kt> (raw)
In-Reply-To: <CAJuCfpHxpZVnpM2bE25MeFK7CrSsO_pGaYuwVNzre47bb1Jh_w@mail.gmail.com>

* Suren Baghdasaryan <surenb@google.com> [240503 18:29]:
> On Fri, Apr 26, 2024 at 10:15 AM Matthew Wilcox <willy@infradead.org> wrote:
> >
> > Liam asked me if we could do away with the "bool *mmap_locked"
> > parameter, and the problem is that some architctures don't support
> > CONFIG_PER_VMA_LOCK yet.  But we can abstract it ... something like this
> > maybe?
> >
> > (not particularly proposing this for inclusion; just wrote it and want
> > to get it out of my tree so I can get back to other projects.  If anyone
> > wants it, they can test it and submit it for inclusion and stick my
> > S-o-B on it)
> 
> I went through all uses of vma_end_read() to convince myself this is
> safe with CONFIG_PER_VMA_LOCK=n and the change seems fine from
> correctness POV. However the fact that in this configuration
> lock_vma_under_mmap_lock()==NOP and vma_end_read()==mmap_read_unlock()
> does not feel right to me. Current code is more explicit about which
> lock is held and I think it's easier to understand.
> A new interface like below might be a bit better but I'm not sure if
> it's worth it:
> 
...

We could do something like we do in the release_fault_lock(), but
without using the FAULT flag..

/* Naming is hard. */
static inline void release_vma_modification_lock(
		struct vm_area_struct *vma)
{                                                                                                                                      
#ifdef CONFIG_PER_VMA_LOCK
        if (rwsem_is_locked(&vma->vm_lock->lock))
                vma_end_read(vma);                                                                                                
        else                                                                                                                           
                mmap_read_unlock(vma->vm_mm);                                                                                     
#else
        mmap_read_unlock(vma->vm_mm);                                                                                     
#endif
}   



      reply	other threads:[~2024-05-14 22:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-26 17:15 [RFC] Make find_tcp_vma() more efficient Matthew Wilcox
2024-05-03 22:29 ` Suren Baghdasaryan
2024-05-14 22:12   ` Liam R. Howlett [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=l3abhimtyv24oogb5l2is7hml6fcs6vlthbd7n4rmnyou24e5l@capndvics4kt \
    --to=liam.howlett@oracle.com \
    --cc=arjunroy@google.com \
    --cc=linux-mm@kvack.org \
    --cc=netdev@vger.kernel.org \
    --cc=surenb@google.com \
    --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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).