Skip to content

Commit

Permalink
mm/mempolicy: weighted interleave checks wrong parameter
Browse files Browse the repository at this point in the history
weighted interleave presently checks (!node) when it should check
(!il_weight).  This causes a wrong distribution of memory.

Link: https://lkml.kernel.org/r/20240206192853.3589-1-gregory.price@memverge.com
Signed-off-by: Gregory Price <gregory.price@memverge.com>
Reported-by: "Huang, Ying" <ying.huang@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: Hasan Al Maruf <Hasan.Maruf@amd.com>
Cc: Honggyu Kim <honggyu.kim@sk.com>
Cc: Hyeongtak Ji <hyeongtak.ji@sk.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Rakie Kim <rakie.kim@sk.com>
Cc: Ravi Jonnalagadda <ravis.opensrc@micron.com>
Cc: Srinivasulu Thanneeru <sthanneeru.opensrc@micron.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
Gregory Price authored and akpm00 committed Feb 20, 2024
1 parent af22207 commit 27e87df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion mm/mempolicy.c
Original file line number Diff line number Diff line change
Expand Up @@ -1881,7 +1881,7 @@ static unsigned int weighted_interleave_nodes(struct mempolicy *policy)
/* to prevent miscount use tsk->mems_allowed_seq to detect rebind */
cpuset_mems_cookie = read_mems_allowed_begin();
node = current->il_prev;
if (!node || !node_isset(node, policy->nodes)) {
if (!current->il_weight || !node_isset(node, policy->nodes)) {
node = next_node_in(node, policy->nodes);
if (read_mems_allowed_retry(cpuset_mems_cookie))
goto retry;
Expand Down

0 comments on commit 27e87df

Please sign in to comment.