public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] mm: memcg: move charge migration code to memcontrol-v1.c
@ 2024-07-12 14:07 Dan Carpenter
  2024-07-12 18:56 ` Roman Gushchin
  0 siblings, 1 reply; 3+ messages in thread
From: Dan Carpenter @ 2024-07-12 14:07 UTC (permalink / raw)
  To: Roman Gushchin; +Cc: cgroups

Hello Roman Gushchin,

Commit e548ad4a7cbf ("mm: memcg: move charge migration code to
memcontrol-v1.c") from Jun 24, 2024 (linux-next), leads to the
following Smatch static checker warning:

	mm/memcontrol-v1.c:609 mem_cgroup_move_charge_write()
	warn: was expecting a 64 bit value instead of '~(1 | 2)'

mm/memcontrol-v1.c
    599 #ifdef CONFIG_MMU
    600 static int mem_cgroup_move_charge_write(struct cgroup_subsys_state *css,
    601                                  struct cftype *cft, u64 val)
    602 {
    603         struct mem_cgroup *memcg = mem_cgroup_from_css(css);
    604 
    605         pr_warn_once("Cgroup memory moving (move_charge_at_immigrate) is deprecated. "
    606                      "Please report your usecase to linux-mm@kvack.org if you "
    607                      "depend on this functionality.\n");
    608 
--> 609         if (val & ~MOVE_MASK)

val is a u64 and MOVE_MASK is a u32.  This only checks if something in the low
32 bits is set and it ignores the high 32 bits.

    610                 return -EINVAL;
    611 
    612         /*
    613          * No kind of locking is needed in here, because ->can_attach() will
    614          * check this value once in the beginning of the process, and then carry
    615          * on with stale data. This means that changes to this value will only
    616          * affect task migrations starting after the change.
    617          */
    618         memcg->move_charge_at_immigrate = val;
    619         return 0;
    620 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-15  8:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-12 14:07 [bug report] mm: memcg: move charge migration code to memcontrol-v1.c Dan Carpenter
2024-07-12 18:56 ` Roman Gushchin
2024-07-15  8:19   ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox