Thread (10 messages) 10 messages, 2 authors, 2020-05-20

Re: [PATCH mm v4 3/4] mm: move cgroup high memory limit setting into struct page_counter

From: Shakeel Butt <hidden>
Date: 2020-05-19 22:15:56
Also in: linux-mm

On Tue, May 19, 2020 at 10:19 AM Jakub Kicinski [off-list ref] wrote:
High memory limit is currently recorded directly in
struct mem_cgroup. We are about to add a high limit
for swap, move the field to struct page_counter and
add some helpers.

Signed-off-by: Jakub Kicinski <redacted>
Reviewed-by: Shakeel Butt <redacted>
quoted hunk ↗ jump to hunk
--- a/include/linux/page_counter.h
+++ b/include/linux/page_counter.h
...
[snip]
...
+static inline bool page_counter_is_above_high(struct page_counter *counter)
+{
+       return page_counter_read(counter) > READ_ONCE(counter->high);
+}
+
...
[snip]
...
quoted hunk ↗ jump to hunk
--- a/mm/page_counter.c
+++ b/mm/page_counter.c
@@ -198,6 +198,11 @@ int page_counter_set_max(struct page_counter *counter, unsigned long nr_pages)
        }
 }

+void page_counter_set_high(struct page_counter *counter, unsigned long nr_pages)
+{
+       WRITE_ONCE(counter->high, nr_pages);
+}
+
Any reason not to make this static inline like
page_counter_is_above_high() and in page_counter.h?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help