[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJuCfpGtGw+MdGH+NNb+zSZBeJ1ct5p98fV0oD6LFyHXMFwYLA@mail.gmail.com>
Date: Thu, 9 Jan 2025 08:01:03 -0800
From: Suren Baghdasaryan <surenb@...gle.com>
To: Hillf Danton <hdanton@...a.com>
Cc: peterz@...radead.org, lorenzo.stoakes@...cle.com, hannes@...xchg.org,
hughd@...gle.com, linux-mm@...ck.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v8 11/16] mm: replace vm_lock and detached flag with a
reference count
On Thu, Jan 9, 2025 at 2:36 AM Hillf Danton <hdanton@...a.com> wrote:
>
> On Wed, 8 Jan 2025 18:30:20 -0800 Suren Baghdasaryan <surenb@...gle.com>
> > +
> > +static inline void vma_refcount_put(struct vm_area_struct *vma)
> > +{
> > + int oldcnt;
> > +
> > + if (!__refcount_dec_and_test(&vma->vm_refcnt, &oldcnt)) {
> > + rwsem_release(&vma->vmlock_dep_map, _RET_IP_);
>
> In up_read() rwsem is released reguardless wakeup, which is different
> than what is added here. Nit.
Good point. I'll send a fixup since it's a small change. Thanks!
>
> > +
> > + if (is_vma_writer_only(oldcnt - 1))
> > + rcuwait_wake_up(&vma->vm_mm->vma_writer_wait);
> > + }
> > +}
> ...
> > @@ -735,9 +773,10 @@ static inline bool vma_start_read(struct vm_area_struct *vma)
> > * This pairs with RELEASE semantics in vma_end_write_all().
> > */
> > if (unlikely(vma->vm_lock_seq == raw_read_seqcount(&vma->vm_mm->mm_lock_seq))) {
> > - up_read(&vma->vm_lock.lock);
> > + vma_refcount_put(vma);
> > return false;
> > }
>
> void up_read(struct rw_semaphore *sem)
> {
> rwsem_release(&sem->dep_map, _RET_IP_);
> __up_read(sem);
> }
>
Powered by blists - more mailing lists