Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sunrpc: convert queue_wait from global to per-cache-detail waitqueue

The queue_wait waitqueue is currently a file-scoped global, so a
wake_up for one cache_detail wakes pollers on all caches. Convert it
to a per-cache-detail field so that only pollers on the relevant cache
are woken.

Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>

authored by

Jeff Layton and committed by
Chuck Lever
552d0e17 17c1d665

+5 -4
+2
include/linux/sunrpc/cache.h
··· 16 16 #include <linux/atomic.h> 17 17 #include <linux/kstrtox.h> 18 18 #include <linux/proc_fs.h> 19 + #include <linux/wait.h> 19 20 20 21 /* 21 22 * Each cache requires: ··· 115 114 /* fields for communication over channel */ 116 115 struct list_head queue; 117 116 spinlock_t queue_lock; 117 + wait_queue_head_t queue_wait; 118 118 119 119 atomic_t writers; /* how many time is /channel open */ 120 120 time64_t last_close; /* if no writers, when did last close */
+3 -4
net/sunrpc/cache.c
··· 401 401 spin_lock_init(&cd->hash_lock); 402 402 INIT_LIST_HEAD(&cd->queue); 403 403 spin_lock_init(&cd->queue_lock); 404 + init_waitqueue_head(&cd->queue_wait); 404 405 spin_lock(&cache_list_lock); 405 406 cd->nextcheck = 0; 406 407 cd->entries = 0; ··· 971 970 return ret; 972 971 } 973 972 974 - static DECLARE_WAIT_QUEUE_HEAD(queue_wait); 975 - 976 973 static __poll_t cache_poll(struct file *filp, poll_table *wait, 977 974 struct cache_detail *cd) 978 975 { ··· 978 979 struct cache_reader *rp = filp->private_data; 979 980 struct cache_queue *cq; 980 981 981 - poll_wait(filp, &queue_wait, wait); 982 + poll_wait(filp, &cd->queue_wait, wait); 982 983 983 984 /* alway allow write */ 984 985 mask = EPOLLOUT | EPOLLWRNORM; ··· 1258 1259 /* Lost a race, no longer PENDING, so don't enqueue */ 1259 1260 ret = -EAGAIN; 1260 1261 spin_unlock(&detail->queue_lock); 1261 - wake_up(&queue_wait); 1262 + wake_up(&detail->queue_wait); 1262 1263 if (ret == -EAGAIN) { 1263 1264 kfree(buf); 1264 1265 kfree(crq);