Skip to contentSkip to conversation

mm-damon-modify-damon_rand-macro-to-static-inline-function.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jan 20, 2022

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: mm/damon: modify damon_rand() macro to static inline function
has been removed from the -mm tree. Its filename was
mm-damon-modify-damon_rand-macro-to-static-inline-function.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Xin Hao <[email protected]>
Subject: mm/damon: modify damon_rand() macro to static inline function

damon_rand() cannot be implemented as a macro.

Example:

	damon_rand(a++, b);

The value of 'a' will be incremented twice, This is obviously unreasonable, So there fix it.

---

 include/linux/damon.h |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
include/linux/damon.h renamed from include/linux/damon.h~mm-damon-modify-damon_rand-macro-to-static-inline-function +4 -1
@@ -19,7 +19,10 @@
 #define DAMOS_MAX_SCORE		(99)
 
 /* Get a random number in [l, r) */
-#define damon_rand(l, r) (l + prandom_u32_max(r - l))
+static inline unsigned long damon_rand(unsigned long l, unsigned long r)
+{
+	return l + prandom_u32_max(r - l);
+}
 
 /**
  * struct damon_addr_range - Represents an address region of [@start, @end).

_

Patches currently in -mm which might be from [email protected] are