mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 08:31:13 +00:00
Revert changes to convert to ->poll_mask() and aio IOCB_CMD_POLL
The poll() changes were not well thought out, and completely unexplained. They also caused a huge performance regression, because "->poll()" was no longer a trivial file operation that just called down to the underlying file operations, but instead did at least two indirect calls. Indirect calls are sadly slow now with the Spectre mitigation, but the performance problem could at least be largely mitigated by changing the "->get_poll_head()" operation to just have a per-file-descriptor pointer to the poll head instead. That gets rid of one of the new indirections. But that doesn't fix the new complexity that is completely unwarranted for the regular case. The (undocumented) reason for the poll() changes was some alleged AIO poll race fixing, but we don't make the common case slower and more complex for some uncommon special case, so this all really needs way more explanations and most likely a fundamental redesign. [ This revert is a revert of about 30 different commits, not reverted individually because that would just be unnecessarily messy - Linus ] Cc: Al Viro <viro@zeniv.linux.org.uk> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
f57494321c
commit
a11e1d432b
80 changed files with 302 additions and 451 deletions
19
fs/eventfd.c
19
fs/eventfd.c
|
@ -101,20 +101,14 @@ static int eventfd_release(struct inode *inode, struct file *file)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static struct wait_queue_head *
|
||||
eventfd_get_poll_head(struct file *file, __poll_t events)
|
||||
{
|
||||
struct eventfd_ctx *ctx = file->private_data;
|
||||
|
||||
return &ctx->wqh;
|
||||
}
|
||||
|
||||
static __poll_t eventfd_poll_mask(struct file *file, __poll_t eventmask)
|
||||
static __poll_t eventfd_poll(struct file *file, poll_table *wait)
|
||||
{
|
||||
struct eventfd_ctx *ctx = file->private_data;
|
||||
__poll_t events = 0;
|
||||
u64 count;
|
||||
|
||||
poll_wait(file, &ctx->wqh, wait);
|
||||
|
||||
/*
|
||||
* All writes to ctx->count occur within ctx->wqh.lock. This read
|
||||
* can be done outside ctx->wqh.lock because we know that poll_wait
|
||||
|
@ -156,11 +150,11 @@ static __poll_t eventfd_poll_mask(struct file *file, __poll_t eventmask)
|
|||
count = READ_ONCE(ctx->count);
|
||||
|
||||
if (count > 0)
|
||||
events |= (EPOLLIN & eventmask);
|
||||
events |= EPOLLIN;
|
||||
if (count == ULLONG_MAX)
|
||||
events |= EPOLLERR;
|
||||
if (ULLONG_MAX - 1 > count)
|
||||
events |= (EPOLLOUT & eventmask);
|
||||
events |= EPOLLOUT;
|
||||
|
||||
return events;
|
||||
}
|
||||
|
@ -311,8 +305,7 @@ static const struct file_operations eventfd_fops = {
|
|||
.show_fdinfo = eventfd_show_fdinfo,
|
||||
#endif
|
||||
.release = eventfd_release,
|
||||
.get_poll_head = eventfd_get_poll_head,
|
||||
.poll_mask = eventfd_poll_mask,
|
||||
.poll = eventfd_poll,
|
||||
.read = eventfd_read,
|
||||
.write = eventfd_write,
|
||||
.llseek = noop_llseek,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue