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

eventfd: make eventfd_signal{_mask}() void

No caller care about the return value.

Link: https://lore.kernel.org/r/20231122-vfs-eventfd-signal-v2-4-bd549b14ce0c@kernel.org
Reviewed-by: Jan Kara <jack@suse.cz>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Christian Brauner <brauner@kernel.org>

+22 -34
+15 -25
fs/eventfd.c
··· 43 43 int id; 44 44 }; 45 45 46 - __u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask) 46 + /** 47 + * eventfd_signal_mask - Increment the event counter 48 + * @ctx: [in] Pointer to the eventfd context. 49 + * @mask: [in] poll mask 50 + * 51 + * This function is supposed to be called by the kernel in paths that do not 52 + * allow sleeping. In this function we allow the counter to reach the ULLONG_MAX 53 + * value, and we signal this as overflow condition by returning a EPOLLERR 54 + * to poll(2). 55 + */ 56 + void eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask) 47 57 { 48 58 unsigned long flags; 49 - __u64 n = 1; 50 59 51 60 /* 52 61 * Deadlock or stack overflow issues can happen if we recurse here ··· 66 57 * safe context. 67 58 */ 68 59 if (WARN_ON_ONCE(current->in_eventfd)) 69 - return 0; 60 + return; 70 61 71 62 spin_lock_irqsave(&ctx->wqh.lock, flags); 72 63 current->in_eventfd = 1; 73 - if (ULLONG_MAX - ctx->count < n) 74 - n = ULLONG_MAX - ctx->count; 75 - ctx->count += n; 64 + if (ctx->count < ULLONG_MAX) 65 + ctx->count++; 76 66 if (waitqueue_active(&ctx->wqh)) 77 67 wake_up_locked_poll(&ctx->wqh, EPOLLIN | mask); 78 68 current->in_eventfd = 0; 79 69 spin_unlock_irqrestore(&ctx->wqh.lock, flags); 80 - 81 - return n == 1; 82 70 } 83 - 84 - /** 85 - * eventfd_signal - Increment the event counter 86 - * @ctx: [in] Pointer to the eventfd context. 87 - * 88 - * This function is supposed to be called by the kernel in paths that do not 89 - * allow sleeping. In this function we allow the counter to reach the ULLONG_MAX 90 - * value, and we signal this as overflow condition by returning a EPOLLERR 91 - * to poll(2). 92 - * 93 - * Returns the amount by which the counter was incremented. 94 - */ 95 - __u64 eventfd_signal(struct eventfd_ctx *ctx) 96 - { 97 - return eventfd_signal_mask(ctx, 0); 98 - } 99 - EXPORT_SYMBOL_GPL(eventfd_signal); 71 + EXPORT_SYMBOL_GPL(eventfd_signal_mask); 100 72 101 73 static void eventfd_free_ctx(struct eventfd_ctx *ctx) 102 74 {
+7 -9
include/linux/eventfd.h
··· 35 35 struct file *eventfd_fget(int fd); 36 36 struct eventfd_ctx *eventfd_ctx_fdget(int fd); 37 37 struct eventfd_ctx *eventfd_ctx_fileget(struct file *file); 38 - __u64 eventfd_signal(struct eventfd_ctx *ctx); 39 - __u64 eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask); 38 + void eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask); 40 39 int eventfd_ctx_remove_wait_queue(struct eventfd_ctx *ctx, wait_queue_entry_t *wait, 41 40 __u64 *cnt); 42 41 void eventfd_ctx_do_read(struct eventfd_ctx *ctx, __u64 *cnt); ··· 57 58 return ERR_PTR(-ENOSYS); 58 59 } 59 60 60 - static inline int eventfd_signal(struct eventfd_ctx *ctx) 61 + static inline void eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask) 61 62 { 62 - return -ENOSYS; 63 - } 64 - 65 - static inline int eventfd_signal_mask(struct eventfd_ctx *ctx, __poll_t mask) 66 - { 67 - return -ENOSYS; 68 63 } 69 64 70 65 static inline void eventfd_ctx_put(struct eventfd_ctx *ctx) ··· 83 90 } 84 91 85 92 #endif 93 + 94 + static inline void eventfd_signal(struct eventfd_ctx *ctx) 95 + { 96 + eventfd_signal_mask(ctx, 0); 97 + } 86 98 87 99 #endif /* _LINUX_EVENTFD_H */ 88 100