Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754732AbdCPWiq (ORCPT ); Thu, 16 Mar 2017 18:38:46 -0400 Received: from mail-it0-f65.google.com ([209.85.214.65]:34561 "EHLO mail-it0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753346AbdCPWil (ORCPT ); Thu, 16 Mar 2017 18:38:41 -0400 MIME-Version: 1.0 In-Reply-To: <1489702304.28631.251.camel@edumazet-glaptop3.roam.corp.google.com> References: <20170316183142.15806.38824.stgit@localhost.localdomain> <20170316183302.15806.2645.stgit@localhost.localdomain> <1489702304.28631.251.camel@edumazet-glaptop3.roam.corp.google.com> From: Alexander Duyck Date: Thu, 16 Mar 2017 15:38:39 -0700 Message-ID: Subject: Re: [net-next PATCH 5/5] epoll: Add busy poll support to epoll with socket fds. To: Eric Dumazet Cc: Netdev , "linux-kernel@vger.kernel.org" , "Samudrala, Sridhar" , Eric Dumazet , David Miller Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 759 Lines: 25 On Thu, Mar 16, 2017 at 3:11 PM, Eric Dumazet wrote: > On Thu, 2017-03-16 at 11:33 -0700, Alexander Duyck wrote: >> From: Sridhar Samudrala > >> +/* >> + * 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 )) Thanks. Will make sure to update to use that for v2. - Alex