Re: [PATCH v3 1/4] mm, memcontrol: avoid duplicated memcg enable check

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

 



Hi, Kairui,

Sorry for jumping in so late.

Kairui Song <ryncsn@xxxxxxxxx> writes:

> From: Kairui Song <kasong@xxxxxxxxxxx>
>
> mem_cgroup_uncharge_swap() includes a mem_cgroup_disabled() check,
> so the caller doesn't need to check that.
>
> Signed-off-by: Kairui Song <kasong@xxxxxxxxxxx>
> Reviewed-by: Yosry Ahmed <yosryahmed@xxxxxxxxxx>
> Reviewed-by: Roman Gushchin <roman.gushchin@xxxxxxxxx>
> Acked-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>
> Acked-by: Chris Li <chrisl@xxxxxxxxxx>
> ---
>  mm/memcontrol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> index 7b3503d12aaf..79900a486ed1 100644
> --- a/mm/memcontrol.c
> +++ b/mm/memcontrol.c
> @@ -4609,7 +4609,7 @@ void mem_cgroup_swapin_uncharge_swap(swp_entry_t entry, unsigned int nr_pages)
>  	 * correspond 1:1 to page and swap slot lifetimes: we charge the
>  	 * page to memory here, and uncharge swap when the slot is freed.
>  	 */
> -	if (!mem_cgroup_disabled() && do_memsw_account()) {
> +	if (do_memsw_account()) {
>  		/*
>  		 * The swap entry might not get freed for a long time,
>  		 * let's not wait for it.  The page already received a

I take a look at memcontrol.c, it appears that almost all extern
functions check mem_cgroup_disabled() as the first step.  So I guess
that this is a convention of memcontrol.c?  And the benefit of the
change is minimal.  In contrast, if someone makes more changes to
mem_cgroup_swapin_uncharge_swap() in the future, he may forget to add
this back.  So, it may be unnecessary to make the change?

---
Best Regards,
Huang, Ying




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

  Powered by Linux