The patch titled Subject: mm/damon: modify damon_rand() macro to static inline function has been added to the -mm tree. Its filename is mm-damon-modify-damon_rand-macro-to-static-inline-function.patch This patch should soon appear at https://ozlabs.org/~akpm/mmots/broken-out/mm-damon-modify-damon_rand-macro-to-static-inline-function.patch and later at https://ozlabs.org/~akpm/mmotm/broken-out/mm-damon-modify-damon_rand-macro-to-static-inline-function.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Xin Hao <xhao@xxxxxxxxxxxxxxxxx> 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. Link: https://lkml.kernel.org/r/110ffcd4e420c86c42b41ce2bc9f0fe6a4f32cd3.1638795127.git.xhao@xxxxxxxxxxxxxxxxx Fixes: b9a6ac4e4ede ("mm/damon: adaptively adjust regions") Signed-off-by: Xin Hao <xhao@xxxxxxxxxxxxxxxxx> Reported-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> Reviewed-by: SeongJae Park <sj@xxxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/damon.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/include/linux/damon.h~mm-damon-modify-damon_rand-macro-to-static-inline-function +++ a/include/linux/damon.h @@ -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 xhao@xxxxxxxxxxxxxxxxx are mm-damon-unified-access_check-function-naming-rules.patch mm-damon-add-age-of-region-tracepoint-support.patch mm-damon-core-using-function-abs-instead-of-diff_of.patch mm-damon-remove-some-no-need-func-definitions-in-damonh-file.patch mm-damon-schemes-add-the-validity-judgment-of-thresholds.patch mm-damon-move-damon_rand-definition-into-damonh.patch mm-damon-modify-damon_rand-macro-to-static-inline-function.patch