Re: [PATCH -next] fs/epoll: simply CONFIG_NET_RX_BUSY_POLL ifdefery

From: Andrew Morton
Date: Wed Jul 25 2018 - 15:35:18 EST


On Wed, 25 Jul 2018 11:56:20 -0700 Davidlohr Bueso <dave@xxxxxxxxxxxx> 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 */

_