Hi, Matthew, Matthew Wilcox <willy@xxxxxxxxxxxxx> writes: > On Tue, Jun 25, 2024 at 02:26:05PM +0100, Tvrtko Ursulin wrote: >> /* >> - * Currently, the only defined flags are mutually exclusive >> + * The below two flags are mutually exclusive: >> */ >> if (flags & MPOL_F_STATIC_NODES) >> p += snprintf(p, buffer + maxlen - p, "static"); >> else if (flags & MPOL_F_RELATIVE_NODES) >> p += snprintf(p, buffer + maxlen - p, "relative"); >> + >> + if (flags & MPOL_F_NUMA_BALANCING) >> + p += snprintf(p, buffer + maxlen - p, "balancing"); >> } > > So if MPOL_F_STATIC_NODES and MPOL_F_NUMA_BALANCING are set, then we > get a string "staticbalancing"? Is that intended? > > Or are these three all mutually exclusive and that should have been > as "else if"? Yes, this is an issue! Dig the git history, in commit 2291990ab36b ("mempolicy: clean-up mpol-to-str() mempolicy formatting"), the support for multiple flags are removed. I think that we need to restore it. Done some basic testing. It was found that when MPOL_F_NUMA_BALANCING is set, /proc/PID/numa_maps always display "default". That is wrong. This make me think that this patch has never been tested! The "default" displaying is introduced in commit 8790c71a18e5 ("mm/mempolicy.c: fix mempolicy printing in numa_maps"). We need to fix it firstly for MPOL_F_NUMA_BALANCING with more accurate filtering. The fix needs to be backported to -stable kernel. -- Best Regards, Huang, Ying