Re: [PATCH] mm: memcontrol.c: move mem_cgroup_id_get_many under CONFIG_MMU

From: Chris Down
Date: Tue Dec 17 2019 - 09:37:25 EST


Qian Cai writes:
__maybe_unused should only be used in the last resort as it mark the compiler to catch the real issues in the future. In this case, it might be better just ignore it as only non-realistic compiling test would use !CONFIG_MMU in this case.

While that's true, I'd rather not end up with getting more patches based on tests like these. On balance the risk of adding __maybe_unused here with a note to remove it later seems better than having to reply to every patch removing warnings :-)

I struggle to imagine a real issue this would catch that wouldn't already be caught by other means. If it's just the risks of dead code, that seems equally risky as taking time away from reviewers.

We should probably also review the coding style doc again, since this looks suspect:

If you have a function or variable which may potentially go unused in a
particular configuration, and the compiler would warn about its definition
going unused, mark the definition as __maybe_unused rather than wrapping it in
a preprocessor conditional. (However, if a function or variable *always* goes
unused, delete it.)