[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250109103602.1555-1-hdanton@sina.com>
Date: Thu, 9 Jan 2025 18:35:59 +0800
From: Hillf Danton <hdanton@...a.com>
To: Suren Baghdasaryan <surenb@...gle.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 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.
> +
> + 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