[bug report] mm: memcg: move charge migration code to memcontrol-v1.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx 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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]     [Monitors]

  Powered by Linux