mm/page_counter: Move calculating protection values to page_counter
Subsystems (4)
PATCH 1/1 mm/page_counter: Move calculating protection values to page_counter
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.
--- include/linux/page_counter.h | 4 + mm/memcontrol.c | 154 +------------------------------ mm/page_counter.c | 173 +++++++++++++++++++++++++++++++++++ 3 files changed, 180 insertions(+), 151 deletions(-)
include/linux/page_counter.h +4 -0
@@ -81,4 +81,8 @@ static inline void page_counter_reset_watermark(struct page_counter *counter) counter->watermark = page_counter_read(counter); } +void page_counter_calculate_protection (struct page_counter *root, +struct page_counter *counter, +bool recursive_protection); +#endif /* _LINUX_PAGE_COUNTER_H */
mm/memcontrol.c +3 -151
172 lines not on this page · raw message
mm/page_counter.c +173 -0
176 lines not on this page · raw message
Signature · 1 line
2.45.2
Quoted 7 lines · Maarten Lankhorst
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 <[email protected]>Acked-by Roman Gushchin <[email protected]>Acked-by Shakeel Butt <[email protected]>---
...
Quoted 4 lines
+/**
+ *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'
Quoted 11 lines
+ * @recursive_protection: Whether to use
memory_recursiveprotbehavior.
+ *
+ * Calculates elow/emin thresholds for givenpage_counter.
+ *
+ * WARNING: This function is not stateless! It can only be used as part
+ * of a top-down tree iteration, not for isolated queries.
+ */mm/page_counter.c +4
-0+void page_counter_calculate_protection (struct page_counter *root, +struct page_counter *counter, +bool recursive_protection) +{