Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-22 Thread David Finkel
On Mon, Jul 22, 2024 at 3:47 PM Waiman Long wrote: > > On 7/22/24 15:30, David Finkel wrote: > >>> diff --git a/mm/page_counter.c b/mm/page_counter.c > >>> index db20d6452b71..40d5f4990218 100644 > >>> --- a/mm/page_counter.c > >>> +++ b/mm/page_counter.c > >>> @@ -82,6 +82,8 @@ void page_counter_

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-22 Thread Waiman Long
On 7/22/24 15:30, David Finkel wrote: diff --git a/mm/page_counter.c b/mm/page_counter.c index db20d6452b71..40d5f4990218 100644 --- a/mm/page_counter.c +++ b/mm/page_counter.c @@ -82,6 +82,8 @@ void page_counter_charge(struct page_counter *counter, unsigned long nr_pages) */

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-22 Thread David Finkel
Roman, Thanks for the review. On Mon, Jul 22, 2024 at 2:22 PM Roman Gushchin wrote: > > On Mon, Jul 22, 2024 at 11:17:13AM -0400, David Finkel wrote: > > Other mechanisms for querying the peak memory usage of either a process > > or v1 memory cgroup allow for resetting the high watermark. Restor

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-22 Thread Roman Gushchin
On Mon, Jul 22, 2024 at 11:17:13AM -0400, David Finkel wrote: > Other mechanisms for querying the peak memory usage of either a process > or v1 memory cgroup allow for resetting the high watermark. Restore > parity with those mechanisms, but with a less racy API. > > For example: > - Any write to

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-22 Thread David Finkel
On Thu, Jul 18, 2024 at 11:23 PM Waiman Long wrote: > > > On 7/18/24 17:49, David Finkel wrote: > > I spent some time today attempting to implement this. > > Here's a branch on github that compiles, and I think is close to what you > > described, but is definitely still a WIP: > > > > https://gith

[PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-22 Thread David Finkel
Other mechanisms for querying the peak memory usage of either a process or v1 memory cgroup allow for resetting the high watermark. Restore parity with those mechanisms, but with a less racy API. For example: - Any write to memory.max_usage_in_bytes in a cgroup v1 mount resets the high waterma

[PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers (fd-local edition)

2024-07-22 Thread David Finkel
My last patch[1] was met with a general desire for a safer scheme that avoided global resets, which expose unclear ownership. Fortunately, Johannes[2] suggested a reasonably simple scheme to provide an FD-local reset, which eliminates most of those issues. The one open question I have is whether

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-18 Thread Waiman Long
On 7/18/24 17:49, David Finkel wrote: I spent some time today attempting to implement this. Here's a branch on github that compiles, and I think is close to what you described, but is definitely still a WIP: https://github.com/torvalds/linux/compare/master...dfinkel:linux:memcg2_memory_peak_fd

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-18 Thread David Finkel
On Wed, Jul 17, 2024 at 1:04 PM Johannes Weiner wrote: > > On Tue, Jul 16, 2024 at 06:44:11AM -1000, Tejun Heo wrote: > > Hello, > > > > On Tue, Jul 16, 2024 at 03:48:17PM +0200, Michal Hocko wrote: > > ... > > > > This behavior is particularly useful for work scheduling systems that > > > > need

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-18 Thread Michal Hocko
On Wed 17-07-24 16:44:53, Johannes Weiner wrote: [...] > The problem is that once global resetting is allowed, it makes the > number reported in memory.peak unreliable for everyone. You just don't > know, and can't tell, if somebody wrote to it recently. It's not too > much of a leap to say this br

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-17 Thread Waiman Long
On 7/17/24 21:24, Tejun Heo wrote: On Wed, Jul 17, 2024 at 07:48:40PM -0400, Waiman Long wrote: ... How about letting .peak shows two numbers? The first one is the peak since the creation of the cgroup and cannot be reset. The second one is a local maximum that can be reset to 0. We just to ke

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-17 Thread Roman Gushchin
On Wed, Jul 17, 2024 at 03:24:49PM -1000, Tejun Heo wrote: > On Wed, Jul 17, 2024 at 07:48:40PM -0400, Waiman Long wrote: > ... > > How about letting .peak shows two numbers? The first one is the peak since > > the creation of the cgroup and cannot be reset. The second one is a local > > maximum th

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-17 Thread Tejun Heo
On Wed, Jul 17, 2024 at 07:48:40PM -0400, Waiman Long wrote: ... > How about letting .peak shows two numbers? The first one is the peak since > the creation of the cgroup and cannot be reset. The second one is a local > maximum that can be reset to 0. We just to keep track of one more counter > tha

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-17 Thread Waiman Long
On 7/17/24 17:13, David Finkel wrote: On Wed, Jul 17, 2024 at 4:44 PM Johannes Weiner wrote: On Wed, Jul 17, 2024 at 04:14:07PM -0400, David Finkel wrote: On Wed, Jul 17, 2024 at 1:04 PM Johannes Weiner wrote: On Tue, Jul 16, 2024 at 06:44:11AM -1000, Tejun Heo wrote: Hello, On Tue, Jul 16

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-17 Thread David Finkel
On Wed, Jul 17, 2024 at 4:44 PM Johannes Weiner wrote: > > On Wed, Jul 17, 2024 at 04:14:07PM -0400, David Finkel wrote: > > On Wed, Jul 17, 2024 at 1:04 PM Johannes Weiner wrote: > > > > > > On Tue, Jul 16, 2024 at 06:44:11AM -1000, Tejun Heo wrote: > > > > Hello, > > > > > > > > On Tue, Jul 16,

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-17 Thread Johannes Weiner
On Wed, Jul 17, 2024 at 04:14:07PM -0400, David Finkel wrote: > On Wed, Jul 17, 2024 at 1:04 PM Johannes Weiner wrote: > > > > On Tue, Jul 16, 2024 at 06:44:11AM -1000, Tejun Heo wrote: > > > Hello, > > > > > > On Tue, Jul 16, 2024 at 03:48:17PM +0200, Michal Hocko wrote: > > > ... > > > > > This

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-17 Thread David Finkel
On Wed, Jul 17, 2024 at 1:04 PM Johannes Weiner wrote: > > On Tue, Jul 16, 2024 at 06:44:11AM -1000, Tejun Heo wrote: > > Hello, > > > > On Tue, Jul 16, 2024 at 03:48:17PM +0200, Michal Hocko wrote: > > ... > > > > This behavior is particularly useful for work scheduling systems that > > > > need

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-17 Thread Johannes Weiner
On Tue, Jul 16, 2024 at 06:44:11AM -1000, Tejun Heo wrote: > Hello, > > On Tue, Jul 16, 2024 at 03:48:17PM +0200, Michal Hocko wrote: > ... > > > This behavior is particularly useful for work scheduling systems that > > > need to track memory usage of worker processes/cgroups per-work-item. > > >

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-17 Thread Michal Hocko
On Wed 17-07-24 10:24:07, David Finkel wrote: > On Wed, Jul 17, 2024 at 2:26 AM Michal Hocko wrote: > > > > On Tue 16-07-24 18:06:17, David Finkel wrote: [...] > > > I'm thinking of something like "global_reset\n", so if we do something > > > like the > > > PSI interface later, users can write "f

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-17 Thread David Finkel
On Wed, Jul 17, 2024 at 2:26 AM Michal Hocko wrote: > > On Tue 16-07-24 18:06:17, David Finkel wrote: > > On Tue, Jul 16, 2024 at 4:00 PM Tejun Heo wrote: > > > > > > Hello, > > > > > > On Tue, Jul 16, 2024 at 08:00:52PM +0200, Michal Hocko wrote: > > > ... > > > > > If we want to allow peak meas

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread Michal Hocko
On Tue 16-07-24 18:06:17, David Finkel wrote: > On Tue, Jul 16, 2024 at 4:00 PM Tejun Heo wrote: > > > > Hello, > > > > On Tue, Jul 16, 2024 at 08:00:52PM +0200, Michal Hocko wrote: > > ... > > > > If we want to allow peak measurement of time periods, I wonder whether > > > > we > > > > could do

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread Michal Hocko
On Tue 16-07-24 10:00:10, Tejun Heo wrote: > Hello, > > On Tue, Jul 16, 2024 at 08:00:52PM +0200, Michal Hocko wrote: > ... > > > If we want to allow peak measurement of time periods, I wonder whether we > > > could do something similar to pressure triggers - ie. let users register > > > watchers

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread David Finkel
On Tue, Jul 16, 2024 at 4:00 PM Tejun Heo wrote: > > Hello, > > On Tue, Jul 16, 2024 at 08:00:52PM +0200, Michal Hocko wrote: > ... > > > If we want to allow peak measurement of time periods, I wonder whether we > > > could do something similar to pressure triggers - ie. let users register > > > w

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread David Finkel
On Tue, Jul 16, 2024 at 3:48 PM Tejun Heo wrote: > > Hello, > > On Tue, Jul 16, 2024 at 01:10:14PM -0400, David Finkel wrote: > > > Swap still has bad reps but there's nothing drastically worse about it > > > than > > > page cache. ie. If you're under memory pressure, you get thrashing one way >

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread Tejun Heo
Hello, On Tue, Jul 16, 2024 at 08:00:52PM +0200, Michal Hocko wrote: ... > > If we want to allow peak measurement of time periods, I wonder whether we > > could do something similar to pressure triggers - ie. let users register > > watchers so that each user can define their own watch periods. Thi

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread Tejun Heo
Hello, On Tue, Jul 16, 2024 at 05:01:15PM +, Roman Gushchin wrote: > > If we want to allow peak measurement of time periods, I wonder whether we > > could do something similar to pressure triggers - ie. let users register > > watchers so that each user can define their own watch periods. This

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread Tejun Heo
Hello, On Tue, Jul 16, 2024 at 01:10:14PM -0400, David Finkel wrote: > > Swap still has bad reps but there's nothing drastically worse about it than > > page cache. ie. If you're under memory pressure, you get thrashing one way > > or another. If there's no swap, the system is just memlocking anon

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread Michal Hocko
On Tue 16-07-24 06:44:11, Tejun Heo wrote: > Hello, > > On Tue, Jul 16, 2024 at 03:48:17PM +0200, Michal Hocko wrote: > ... > > > This behavior is particularly useful for work scheduling systems that > > > need to track memory usage of worker processes/cgroups per-work-item. > > > Since memory can

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread David Finkel
On Tue, Jul 16, 2024 at 1:01 PM Roman Gushchin wrote: > > On Tue, Jul 16, 2024 at 06:44:11AM -1000, Tejun Heo wrote: > > Hello, > > > > On Tue, Jul 16, 2024 at 03:48:17PM +0200, Michal Hocko wrote: > > ... > > > > The removal of resets was intentional. The problem was that it wasn't clear > > who

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread David Finkel
On Tue, Jul 16, 2024 at 12:44 PM Tejun Heo wrote: > > Hello, > > On Tue, Jul 16, 2024 at 03:48:17PM +0200, Michal Hocko wrote: > ... > > > This behavior is particularly useful for work scheduling systems that > > > need to track memory usage of worker processes/cgroups per-work-item. > > > Since m

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread Roman Gushchin
On Tue, Jul 16, 2024 at 06:44:11AM -1000, Tejun Heo wrote: > Hello, > > On Tue, Jul 16, 2024 at 03:48:17PM +0200, Michal Hocko wrote: > ... > > The removal of resets was intentional. The problem was that it wasn't clear > who owned those counters and there's no way of telling who reset what when.

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread Tejun Heo
Hello, On Tue, Jul 16, 2024 at 03:48:17PM +0200, Michal Hocko wrote: ... > > This behavior is particularly useful for work scheduling systems that > > need to track memory usage of worker processes/cgroups per-work-item. > > Since memory can't be squeezed like CPU can (the OOM-killer has > > opini

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread David Finkel
On Tue, Jul 16, 2024 at 9:48 AM Michal Hocko wrote: > > On Mon 15-07-24 16:36:26, David Finkel wrote: > > Other mechanisms for querying the peak memory usage of either a process > > or v1 memory cgroup allow for resetting the high watermark. Restore > > parity with those mechanisms. > > > > For ex

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread Michal Hocko
On Mon 15-07-24 16:36:26, David Finkel wrote: > Other mechanisms for querying the peak memory usage of either a process > or v1 memory cgroup allow for resetting the high watermark. Restore > parity with those mechanisms. > > For example: > - Any write to memory.max_usage_in_bytes in a cgroup v1

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread David Finkel
On Tue, Jul 16, 2024 at 9:19 AM Michal Hocko wrote: > > On Tue 16-07-24 08:47:59, David Finkel wrote: > > On Tue, Jul 16, 2024 at 3:20 AM Michal Hocko wrote: > > > > > > On Mon 15-07-24 16:46:36, David Finkel wrote: > > > > > On Mon, Jul 15, 2024 at 4:38 PM David Finkel wrote: > > > > > > > > >

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread Michal Hocko
On Tue 16-07-24 08:47:59, David Finkel wrote: > On Tue, Jul 16, 2024 at 3:20 AM Michal Hocko wrote: > > > > On Mon 15-07-24 16:46:36, David Finkel wrote: > > > > On Mon, Jul 15, 2024 at 4:38 PM David Finkel wrote: > > > > > > > > > > Other mechanisms for querying the peak memory usage of either a

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread David Finkel
On Tue, Jul 16, 2024 at 3:20 AM Michal Hocko wrote: > > On Mon 15-07-24 16:46:36, David Finkel wrote: > > > On Mon, Jul 15, 2024 at 4:38 PM David Finkel wrote: > > > > > > > > Other mechanisms for querying the peak memory usage of either a process > > > > or v1 memory cgroup allow for resetting t

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-16 Thread Michal Hocko
On Mon 15-07-24 16:46:36, David Finkel wrote: > > On Mon, Jul 15, 2024 at 4:38 PM David Finkel wrote: > > > > > > Other mechanisms for querying the peak memory usage of either a process > > > or v1 memory cgroup allow for resetting the high watermark. Restore > > > parity with those mechanisms. >

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-15 Thread David Finkel
[Fixing Shakeel's email address (I didn't notice it changed when comparing my previous "git send-email" commandline and get_mainainer.pl output)] On Mon, Jul 15, 2024 at 4:42 PM David Finkel wrote: > > Note: this is a simple rebase of a patch I sent a few months ago, > which received two acks bef

[PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-15 Thread David Finkel
This is a rebase of a patch I sent a few months ago, on which I received two acks, but the thread petered out: https://www.spinics.net/lists/cgroups/msg40602.html. I'm hoping that it can make it into the next LTS (and 6.11 if possible) Thank you, David Finkel Sr. Principal Software Engineer, Vi

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-15 Thread David Finkel
Note: this is a simple rebase of a patch I sent a few months ago, which received two acks before the thread petered out: https://www.spinics.net/lists/cgroups/msg40602.html Thanks, On Mon, Jul 15, 2024 at 4:38 PM David Finkel wrote: > > Other mechanisms for querying the peak memory usage of eith

[PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-07-15 Thread David Finkel
Other mechanisms for querying the peak memory usage of either a process or v1 memory cgroup allow for resetting the high watermark. Restore parity with those mechanisms. For example: - Any write to memory.max_usage_in_bytes in a cgroup v1 mount resets the high watermark. - writing "5" to the

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2024-02-07 Thread David Finkel
Did I miss a reviewer on this change? I've clearly missed the window for 6.8, but it would be nice to get this into a staging branch for 6.9. (I can definitely rebase and re-mail if necessary) Thanks, David Finkel On Mon, Dec 4, 2023 at 2:42 PM David Finkel wrote: > > Other mechanisms for que

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2023-12-06 Thread Michal Hocko
On Tue 05-12-23 11:00:47, David Finkel wrote: > On Tue, Dec 5, 2023 at 4:07 AM Michal Hocko wrote: > > > > This behavior is particularly useful for work scheduling systems that > > > need to track memory usage of worker processes/cgroups per-work-item. > > > Since memory can't be squeezed like CP

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2023-12-05 Thread David Finkel
On Tue, Dec 5, 2023 at 4:07 AM Michal Hocko wrote: > > This behavior is particularly useful for work scheduling systems that > > need to track memory usage of worker processes/cgroups per-work-item. > > Since memory can't be squeezed like CPU can (the OOM-killer has > > opinions), these systems n

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2023-12-05 Thread Michal Hocko
On Mon 04-12-23 14:41:56, David Finkel wrote: > Other mechanisms for querying the peak memory usage of either a process > or v1 memory cgroup allow for resetting the high watermark. Restore > parity with those mechanisms. > > For example: > - Any write to memory.max_usage_in_bytes in a cgroup v1

Re: [PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2023-12-04 Thread Shakeel Butt
On Mon, Dec 4, 2023 at 11:42 AM David Finkel wrote: > > Other mechanisms for querying the peak memory usage of either a process > or v1 memory cgroup allow for resetting the high watermark. Restore > parity with those mechanisms. > > For example: > - Any write to memory.max_usage_in_bytes in a cg

[PATCH] mm, memcg: cg2 memory{.swap,}.peak write handlers

2023-12-04 Thread David Finkel
Other mechanisms for querying the peak memory usage of either a process or v1 memory cgroup allow for resetting the high watermark. Restore parity with those mechanisms. For example: - Any write to memory.max_usage_in_bytes in a cgroup v1 mount resets the high watermark. - writing "5" to the