Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1602872
| From | Eric Dumazet <eric.dumazet@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [net-next PATCH 5/5] epoll: Add busy poll support to epoll with socket fds. |
| Date | 2017-03-16 23:20 +0100 |
| Message-ID | <tlLUt-4QA-11@gated-at.bofh.it> (permalink) |
| References | <tlItA-2iT-5@gated-at.bofh.it> <tlItA-2iT-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, 2017-03-16 at 11:33 -0700, Alexander Duyck wrote:
> From: Sridhar Samudrala <sridhar.samudrala@intel.com>
> +/*
> + * If busy polling is on and the file is a socket, return a pointer to
> + * struct sock
> + */
> +static inline struct sock *ep_sk_from_file(struct file *file)
> +{
> + struct inode *inode = file_inode(file);
> +
> + if (!S_ISSOCK(inode->i_mode))
> + return NULL;
> +
> + return ((struct socket *)file->private_data)->sk;
> +}
I believe a more standard way is to use sock_from_file()
(This does not have to fetch a cache line to read i_mode ))
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[net-next PATCH 5/5] epoll: Add busy poll support to epoll with socket fds. Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-16 19:40 +0100
Re: [net-next PATCH 5/5] epoll: Add busy poll support to epoll with socket fds. Eric Dumazet <eric.dumazet@gmail.com> - 2017-03-16 23:20 +0100
Re: [net-next PATCH 5/5] epoll: Add busy poll support to epoll with socket fds. Alexander Duyck <alexander.duyck@gmail.com> - 2017-03-16 23:40 +0100
csiph-web