mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH -next] fs/epoll: simply CONFIG_NET_RX_BUSY_POLL ifdefery
@ 2018-07-25 18:56 Davidlohr Bueso
  2018-07-25 19:35 ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Davidlohr Bueso @ 2018-07-25 18:56 UTC (permalink / raw)
  To: akpm; +Cc: jbaron, viro, linux-kernel, dave, Davidlohr Bueso

... 'tis easier on the eye.

Signed-off-by: Davidlohr Bueso <dbueso@suse.de>
---
 fs/eventpoll.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 1b1abc461fc0..0ab82d0d4e02 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -391,7 +391,6 @@ static bool ep_busy_loop_end(void *p, unsigned long start_time)
 
 	return ep_events_available(ep) || busy_loop_timeout(start_time);
 }
-#endif /* CONFIG_NET_RX_BUSY_POLL */
 
 /*
  * Busy poll if globally on and supporting sockets found && no events,
@@ -401,20 +400,16 @@ static bool ep_busy_loop_end(void *p, unsigned long start_time)
  */
 static void ep_busy_loop(struct eventpoll *ep, int nonblock)
 {
-#ifdef CONFIG_NET_RX_BUSY_POLL
 	unsigned int napi_id = READ_ONCE(ep->napi_id);
 
 	if ((napi_id >= MIN_NAPI_ID) && net_busy_loop_on())
 		napi_busy_loop(napi_id, nonblock ? NULL : ep_busy_loop_end, ep);
-#endif
 }
 
 static inline void ep_reset_busy_poll_napi_id(struct eventpoll *ep)
 {
-#ifdef CONFIG_NET_RX_BUSY_POLL
 	if (ep->napi_id)
 		ep->napi_id = 0;
-#endif
 }
 
 /*
@@ -422,7 +417,6 @@ static inline void ep_reset_busy_poll_napi_id(struct eventpoll *ep)
  */
 static inline void ep_set_busy_poll_napi_id(struct epitem *epi)
 {
-#ifdef CONFIG_NET_RX_BUSY_POLL
 	struct eventpoll *ep;
 	unsigned int napi_id;
 	struct socket *sock;
@@ -452,9 +446,15 @@ static inline void ep_set_busy_poll_napi_id(struct epitem *epi)
 
 	/* record NAPI ID for use in next busy poll */
 	ep->napi_id = napi_id;
-#endif
 }
 
+#else
+#define ep_busy_loop(ep, nonblock)		do { } while (0)
+#define ep_reset_busy_poll_napi_id(ep)		do { } while (0)
+#define ep_set_busy_poll_napi_id(epi)		do { } while (0)
+
+#endif /* CONFIG_NET_RX_BUSY_POLL */
+
 /**
  * ep_call_nested - Perform a bound (possibly) nested call, by checking
  *                  that the recursion limit is not exceeded, and that
-- 
2.16.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] fs/epoll: simply CONFIG_NET_RX_BUSY_POLL ifdefery
  2018-07-25 18:56 [PATCH -next] fs/epoll: simply CONFIG_NET_RX_BUSY_POLL ifdefery Davidlohr Bueso
@ 2018-07-25 19:35 ` Andrew Morton
  2018-07-25 20:06   ` Davidlohr Bueso
  0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2018-07-25 19:35 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: jbaron, viro, linux-kernel, Davidlohr Bueso

On Wed, 25 Jul 2018 11:56:20 -0700 Davidlohr Bueso <dave@stgolabs.net> wrote:

> ... 'tis easier on the eye.

true, but.

> +#else
> +#define ep_busy_loop(ep, nonblock)		do { } while (0)
> +#define ep_reset_busy_poll_napi_id(ep)		do { } while (0)
> +#define ep_set_busy_poll_napi_id(epi)		do { } while (0)
> +
> +#endif /* CONFIG_NET_RX_BUSY_POLL */

inlines are preferred.  Because macros are fugly and can cause
unused-var warnings when the stub versions are used.

This?

--- a/fs/eventpoll.c~fs-epoll-simply-config_net_rx_busy_poll-ifdefery-fix
+++ a/fs/eventpoll.c
@@ -449,9 +449,18 @@ static inline void ep_set_busy_poll_napi
 }
 
 #else
-#define ep_busy_loop(ep, nonblock)		do { } while (0)
-#define ep_reset_busy_poll_napi_id(ep)		do { } while (0)
-#define ep_set_busy_poll_napi_id(epi)		do { } while (0)
+
+static inline void ep_busy_loop(struct eventpoll *ep, int nonblock)
+{
+}
+
+static inline void ep_reset_busy_poll_napi_id(struct eventpoll *ep)
+{
+}
+
+static inline void ep_set_busy_poll_napi_id(struct epitem *epi)
+{
+}
 
 #endif /* CONFIG_NET_RX_BUSY_POLL */
 
_


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] fs/epoll: simply CONFIG_NET_RX_BUSY_POLL ifdefery
  2018-07-25 19:35 ` Andrew Morton
@ 2018-07-25 20:06   ` Davidlohr Bueso
  2018-07-25 21:30     ` Andrew Morton
  0 siblings, 1 reply; 4+ messages in thread
From: Davidlohr Bueso @ 2018-07-25 20:06 UTC (permalink / raw)
  To: Andrew Morton; +Cc: jbaron, viro, linux-kernel, Davidlohr Bueso

On Wed, 25 Jul 2018, Andrew Morton wrote:

>On Wed, 25 Jul 2018 11:56:20 -0700 Davidlohr Bueso <dave@stgolabs.net> wrote:
>
>> ... 'tis easier on the eye.
>
>true, but.
>
>> +#else
>> +#define ep_busy_loop(ep, nonblock)		do { } while (0)
>> +#define ep_reset_busy_poll_napi_id(ep)		do { } while (0)
>> +#define ep_set_busy_poll_napi_id(epi)		do { } while (0)
>> +
>> +#endif /* CONFIG_NET_RX_BUSY_POLL */
>
>inlines are preferred.  Because macros are fugly and can cause
>unused-var warnings when the stub versions are used.

Fair enough.

>This?

Do you want me to send a v2 or will you fold in the below?

Thanks,
Davidlohr

>
>--- a/fs/eventpoll.c~fs-epoll-simply-config_net_rx_busy_poll-ifdefery-fix
>+++ a/fs/eventpoll.c
>@@ -449,9 +449,18 @@ static inline void ep_set_busy_poll_napi
> }
>
> #else
>-#define ep_busy_loop(ep, nonblock)		do { } while (0)
>-#define ep_reset_busy_poll_napi_id(ep)		do { } while (0)
>-#define ep_set_busy_poll_napi_id(epi)		do { } while (0)
>+
>+static inline void ep_busy_loop(struct eventpoll *ep, int nonblock)
>+{
>+}
>+
>+static inline void ep_reset_busy_poll_napi_id(struct eventpoll *ep)
>+{
>+}
>+
>+static inline void ep_set_busy_poll_napi_id(struct epitem *epi)
>+{
>+}
>
> #endif /* CONFIG_NET_RX_BUSY_POLL */
>
>_
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] fs/epoll: simply CONFIG_NET_RX_BUSY_POLL ifdefery
  2018-07-25 20:06   ` Davidlohr Bueso
@ 2018-07-25 21:30     ` Andrew Morton
  0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2018-07-25 21:30 UTC (permalink / raw)
  To: Davidlohr Bueso; +Cc: jbaron, viro, linux-kernel, Davidlohr Bueso

On Wed, 25 Jul 2018 13:06:33 -0700 Davidlohr Bueso <dave@stgolabs.net> wrote:

> >> +#else
> >> +#define ep_busy_loop(ep, nonblock)		do { } while (0)
> >> +#define ep_reset_busy_poll_napi_id(ep)		do { } while (0)
> >> +#define ep_set_busy_poll_napi_id(epi)		do { } while (0)
> >> +
> >> +#endif /* CONFIG_NET_RX_BUSY_POLL */
> >
> >inlines are preferred.  Because macros are fugly and can cause
> >unused-var warnings when the stub versions are used.
> 
> Fair enough.
> 
> >This?
> 
> Do you want me to send a v2 or will you fold in the below?

I queued both patches.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-25 21:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25 18:56 [PATCH -next] fs/epoll: simply CONFIG_NET_RX_BUSY_POLL ifdefery Davidlohr Bueso
2018-07-25 19:35 ` Andrew Morton
2018-07-25 20:06   ` Davidlohr Bueso
2018-07-25 21:30     ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®