Re: [PATCH] mm/page_counter: Move calculating protection values to page_counter

From: Jeff Johnson
Date: Wed Jul 10 2024 - 13:30:07 EST


On 7/3/2024 4:25 AM, Maarten Lankhorst wrote:
> It's a lot of math, and there is nothing memcontrol specific about it.
> This makes it easier to use inside of the drm cgroup controller.
>
> Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxxxx>
> Acked-by: Roman Gushchin <roman.gushchin@xxxxxxxxx>
> Acked-by: Shakeel Butt <shakeel.butt@xxxxxxxxx>
> ---
...
> +/**
> + * page_counter_calculate_protection - check if memory consumption is in the normal range
> + * @root: the top ancestor of the sub-tree being checked
> + * @memcg: the memory cgroup to check

need to document @counter instead

mm/page_counter.c:400: warning: Function parameter or struct member 'counter' not described in 'page_counter_calculate_protection'
mm/page_counter.c:400: warning: Excess function parameter 'memcg' description in 'page_counter_calculate_protection'

> + * @recursive_protection: Whether to use memory_recursiveprot behavior.
> + *
> + * Calculates elow/emin thresholds for given page_counter.
> + *
> + * WARNING: This function is not stateless! It can only be used as part
> + * of a top-down tree iteration, not for isolated queries.
> + */
> +void page_counter_calculate_protection(struct page_counter *root,
> + struct page_counter *counter,
> + bool recursive_protection)
> +{