Re: [PATCH 2/3] mm: Charge active memcg when no mm is set

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

 



On Thu, Jun 10, 2021 at 10:39:43AM -0700, Dan Schatzberg <schatzberg.dan@xxxxxxxxx> wrote:
> @@ -926,8 +937,17 @@ struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm)
>  	 * counting is disabled on the root level in the
>  	 * cgroup core. See CSS_NO_REF.
>  	 */
> -	if (unlikely(!mm))
> -		return root_mem_cgroup;
> +	if (unlikely(!mm)) {
> +		memcg = active_memcg();
> +		if (unlikely(memcg)) {
> +			/* remote memcg must hold a ref */
> +			css_get(&memcg->css);
> +			return memcg;
> +		}
> +		mm = current->mm;
> +		if (unlikely(!mm))
> +			return root_mem_cgroup;
> +	}

With the change in __add_to_page_cache_locked() all page cache charges
will supply null mm, so the first !mm unlikely hint may not be warranted
anymore. Just an interesting point, generally, I'm adding

Reviewed-by: Michal Koutný <mkoutny@xxxxxxxx>

Attachment: signature.asc
Description: Digital signature


[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