public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michal Koutný" <mkoutny-IBi9RG/b67k@public.gmane.org>
To: Roman Gushchin <roman.gushchin-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>
Cc: cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Richard Palethorpe <rpalethorpe-IBi9RG/b67k@public.gmane.org>,
	Andrew Morton
	<akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org>,
	Shakeel Butt <shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Michal Hocko <mhocko-IBi9RG/b67k@public.gmane.org>,
	Vlastimil Babka <vbabka-AlSwsSmVLrQ@public.gmane.org>,
	"Matthew Wilcox (Oracle)"
	<willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Muchun Song <songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org>,
	Johannes Weiner <hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org>,
	Yang Shi <shy828301-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Suren Baghdasaryan
	<surenb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Tejun Heo <tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Chris Down <chris-6Bi1550iOqEnzZ6mRAm98g@public.gmane.org>
Subject: Re: [RFC PATCH] mm: memcg: Do not count memory.low reclaim if it does not happen
Date: Fri, 25 Mar 2022 11:31:18 +0100	[thread overview]
Message-ID: <20220325103118.GC2828@blackbody.suse.cz> (raw)
In-Reply-To: <5049EBC3-5BAE-4509-BA63-1F4A7D913517-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>

On Thu, Mar 24, 2022 at 11:17:14AM -0700, Roman Gushchin <roman.gushchin-fxUVXftIFDnyG1zEObXtfA@public.gmane.org> wrote:
> Ok, so it’s not really about the implementation details of the reclaim
> mechanism (I mean rounding up to the batch size etc),

Actually, that was what I deemed more serious first.
It's the point 2 of RFCness:

| 2) The observed behavior slightly impacts distribution of parent's memory.low.
|    Constructed example is a passive protected workload in s1 and active in s2
|    (active ~ counteracts the reclaim with allocations). It could strip
|    protection from s1 one by one (one:=SWAP_CLUSTER_MAX/2^sc.priority).
|    That may be considered both wrong (s1 should have been more protected) or
|    correct s2 deserves protection due to its activity.
|    I don't have (didn't collect) data for this, so I think just masking the
|    false events is sufficient (or independent).

> Idk, I don’t have a strong argument against this change (except that
> it changes the existing behavior), but I also don’t see why such
> events are harmful. Do you mind elaborating a bit more?

So I've collected some demo data now.

	systemd-run \
	        -u precious.service --slice=test-protected.slice \
	        -p MemoryLow=50M \
	        /root/memeater 50 # allocates 50M anon, doesn't use it
	
	systemd-run \
	        -u victim.service --slice=test-protected.slice \
	        -p MemoryLow=0M \
	        /root/memeater -m 50 50 # allocates 50M anon, uses it
	
	echo "Started workloads"
	
	systemctl set-property --runtime test.slice MemoryMax=200M
	systemctl set-property --runtime test-protected.slice MemoryLow=50M
	
	sleep 5
	
	systemd-run \
	        -u pressure.service --slice=test.slice \
	        -p MemorySwapMax=0M \ # to push test-protected.slice to swap
	        /root/memeater -m 170 170
	
	sleep 5
	systemd-cgtop -b -1 -m test.slice

Result with memory_recursiveprot

> Control Group                                                        Tasks   %CPU   Memory  Input/s Output/s
> test.slice                                                               3      -   199.9M        -        -
> test.slice/pressure.service                                              1      -   170.5M        -        -
> test.slice/test-protected.slice                                          2      -    29.4M        -        -
> test.slice/test-protected.slice/victim.service                           1      -    29.1M        -        -
> test.slice/test-protected.slice/precious.service                         1      -   292.0K        -        -

Result without memory_recursiveprot

> Control Group                                                        Tasks   %CPU   Memory  Input/s Output/s
> test.slice                                                               3      -   199.8M        -        -
> test.slice/pressure.service                                              1      -   170.5M        -        -
> test.slice/test-protected.slice                                          2      -    29.3M        -        -
> test.slice/test-protected.slice/precious.service                         1      -    28.7M        -        -
> test.slice/test-protected.slice/victim.service                           1      -   560.0K        -        -

(kernel 5.17.0, systemd 249.10)

So with this result, I'd say the event reporting is an independent change
(admiteddly, thanks to the current implementation (not the proposal of
mine) I noticed this issue).
/me scratches head, let me review my other approaches...


Michal

      parent reply	other threads:[~2022-03-25 10:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 18:22 [RFC PATCH] mm: memcg: Do not count memory.low reclaim if it does not happen Michal Koutný
     [not found] ` <20220322182248.29121-1-mkoutny-IBi9RG/b67k@public.gmane.org>
2022-03-23 21:44   ` Roman Gushchin
     [not found]     ` <YjuUuLW+8iRtYOmP-cx5fftMpWqeCjSd+JxjunQ2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2022-03-24  9:51       ` Michal Koutný
2022-03-24 18:17         ` Roman Gushchin
     [not found]           ` <5049EBC3-5BAE-4509-BA63-1F4A7D913517-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>
2022-03-25 10:31             ` Michal Koutný [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220325103118.GC2828@blackbody.suse.cz \
    --to=mkoutny-ibi9rg/b67k@public.gmane.org \
    --cc=akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=chris-6Bi1550iOqEnzZ6mRAm98g@public.gmane.org \
    --cc=hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=mhocko-IBi9RG/b67k@public.gmane.org \
    --cc=roman.gushchin-fxUVXftIFDnyG1zEObXtfA@public.gmane.org \
    --cc=rpalethorpe-IBi9RG/b67k@public.gmane.org \
    --cc=shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=shy828301-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=songmuchun-EC8Uxl6Npydl57MIdRCFDg@public.gmane.org \
    --cc=surenb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=vbabka-AlSwsSmVLrQ@public.gmane.org \
    --cc=willy-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox