Re: [PATCH] mm: filemap: Avoid unnecessary barries and waitqueue lookups in unlock_page fastpath v4

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, May 15, 2014 at 03:20:58PM +0200, Peter Zijlstra wrote:
> void __unlock_page(struct page *page)
> {
> 	struct wait_bit_key key = __WAIT_BIT_KEY_INITIALIZER(&page->flags, PG_locked);
> 	struct wait_queue_head_t *wqh = page_waitqueue(page);
> 	wait_queue_t *curr;

	if (!PG_waiters && !waitqueue_active(wqh))
		return;

> 	spin_lock_irq(&wqh->lock);
> 	list_for_each_entry(curr, &wqh->task_list, task_list) {
> 		unsigned int flags = curr->flags;
> 
> 		if (curr->func(curr, TASK_NORMAL, 0, &key))
> 			goto unlock;
> 	}
> 	ClearPageWaiters(page);
> unlock:
> 	spin_unlock_irq(&wqh->lock);
> }
> 
> Yes, the __unlock_page() will have the unconditional wqh->lock, but it
> should also call __unlock_page() a lot less, and it doesn't have that
> horrid timeout.
> 
> Now, the above is clearly sub-optimal when !extended_page_flags, but I
> suppose we could have two versions of __unlock_page() for that.

Or I suppose the above would fix it too.

Attachment: pgpZvuJycrNKJ.pgp
Description: PGP signature


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux