Thread (1 message) 1 message, 1 author, 2013-09-30

Re: [PATCH net-next 3/7] net: introduce new macro net_get_random_once

From: David Miller <davem@davemloft.net>
Date: 2013-09-30 19:43:28

From: Hannes Frederic Sowa <redacted>
Date: Fri, 27 Sep 2013 00:56:35 +0200
quoted hunk
+/* BE CAREFUL: this function is not interrupt safe */
+#define net_get_random_once(buf, nbytes)				\
+	({								\
+		static bool ___done = false;				\
+		bool ___ret = false;					\
+		if (unlikely(!___done))					\
+			___ret = __net_get_random_once(buf,		\
+						       nbytes,		\
+						       &___done);	\
+		___ret;							\
+	})
I don't want to see this happening in every fast path, it's silly to test
this every time after the first iteration.

Maybe... _maybe_ I can be convinced if you use a static branch for this so
that it _really_ costs next to nothing.

But as-is I am not going to apply this series, sorry.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help