linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Barry Song <21cnbao@gmail.com>
To: Yosry Ahmed <yosryahmed@google.com>
Cc: Usama Arif <usamaarif642@gmail.com>,
	akpm@linux-foundation.org, linux-mm@kvack.org,
	 linux-kernel@vger.kernel.org, Barry Song <v-songbaohua@oppo.com>,
	 Kanchana P Sridhar <kanchana.p.sridhar@intel.com>,
	David Hildenbrand <david@redhat.com>,
	 Baolin Wang <baolin.wang@linux.alibaba.com>,
	Chris Li <chrisl@kernel.org>,
	 "Huang, Ying" <ying.huang@intel.com>,
	Kairui Song <kasong@tencent.com>,
	 Ryan Roberts <ryan.roberts@arm.com>,
	Johannes Weiner <hannes@cmpxchg.org>,
	 Michal Hocko <mhocko@kernel.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	 Shakeel Butt <shakeel.butt@linux.dev>,
	Muchun Song <muchun.song@linux.dev>
Subject: Re: [PATCH RFC] mm: mitigate large folios usage and swap thrashing for nearly full memcg
Date: Thu, 31 Oct 2024 10:21:27 +1300	[thread overview]
Message-ID: <CAGsJ_4zrgsgzHLWrcr8Fa9nMni7FSokgEkY6yk6Eu6R3O_wL2w@mail.gmail.com> (raw)
In-Reply-To: <CAJD7tkbO0SVUfhHQ46rONy45e8FmoWESegtTLz561aPy2N-Uhw@mail.gmail.com>

On Thu, Oct 31, 2024 at 10:10 AM Yosry Ahmed <yosryahmed@google.com> wrote:
>
> [..]
> > >>> A crucial component is still missing—managing the compression and decompression
> > >>> of multiple pages as a larger block. This could significantly reduce
> > >>> system time and
> > >>> potentially resolve the kernel build issue within a small memory
> > >>> cgroup, even with
> > >>> swap thrashing.
> > >>>
> > >>> I’ll send an update ASAP so you can rebase for zswap.
> > >>
> > >> Did you mean https://lore.kernel.org/all/20241021232852.4061-1-21cnbao@gmail.com/?
> > >> Thats wont benefit zswap, right?
> > >
> > > That's right. I assume we can also make it work with zswap?
> >
> > Hopefully yes. Thats mainly why I was looking at that series, to try and find
> > a way to do something similar for zswap.
>
> I would prefer for these things to be done separately. We still need
> to evaluate the compression/decompression of large blocks. I am mainly
> concerned about having to decompress a large chunk to fault in one
> page.
>
> The obvious problems are fault latency, and wasted work having to
> consistently decompress the large chunk to take one page from it. We
> also need to decide if we'd rather split it after decompression and
> compress the parts that we didn't swap in separately.
>
> This can cause problems beyond the fault latency. Imagine the case
> where the system is under memory pressure, so we fallback to order-0
> swapin to avoid reclaim. Now we want to decompress a chunk that used
> to be 64K.

Yes, this could be an issue.

We had actually tried to utilize several buffers for those partial
swap-in cases,
where the decompressed data was held in anticipation of the upcoming
swap-in. This approach could address the majority of partial swap-ins for
fallback scenarios.

>
> We need to allocate 64K of contiguous memory for a temporary
> allocation to be able to fault a 4K page. Now we either need to:
> - Go into reclaim, which we were trying to avoid to begin with.
> - Dip into reserves to allocate the 64K as it's a temporary
> allocation. This is probably risky because under memory pressure, many
> CPUs may be doing this concurrently.

This has been addressed by using contiguous memory that is prepared on
a per-CPU basis., search the below:
"alloc_pages() might fail, so we don't depend on allocation:"
https://lore.kernel.org/all/20241021232852.4061-1-21cnbao@gmail.com/

Thanks
Barry


  reply	other threads:[~2024-10-30 21:21 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-27  0:14 Barry Song
2024-10-28 12:07 ` Usama Arif
2024-10-28 22:03   ` Barry Song
2024-10-30 14:51     ` Usama Arif
2024-10-30 19:51       ` Yosry Ahmed
2024-10-30 20:25         ` Usama Arif
2024-10-30 21:01           ` Yosry Ahmed
2024-10-30 21:13             ` Usama Arif
2024-10-30 21:18               ` Yosry Ahmed
2024-10-31 15:38                 ` Johannes Weiner
2024-10-31 15:59                   ` Yosry Ahmed
2024-10-31 20:59                     ` Barry Song
2024-11-01 16:19                       ` Yosry Ahmed
2024-11-04  6:42                   ` Huang, Ying
2024-11-04  8:06                     ` Barry Song
2024-11-04 13:09                       ` Huang, Ying
2024-11-04 12:13                     ` Usama Arif
2024-11-05  0:57                       ` Huang, Ying
2024-11-05  1:13                         ` Barry Song
2024-11-05  1:41                           ` Huang, Ying
2024-10-30 20:27       ` Barry Song
2024-10-30 20:41         ` Usama Arif
2024-10-30 20:48           ` Barry Song
2024-10-30 21:00             ` Usama Arif
2024-10-30 21:08               ` Barry Song
2024-10-30 21:10               ` Yosry Ahmed
2024-10-30 21:21                 ` Barry Song [this message]
2024-10-30 21:31                   ` Yosry Ahmed

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=CAGsJ_4zrgsgzHLWrcr8Fa9nMni7FSokgEkY6yk6Eu6R3O_wL2w@mail.gmail.com \
    --to=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=baolin.wang@linux.alibaba.com \
    --cc=chrisl@kernel.org \
    --cc=david@redhat.com \
    --cc=hannes@cmpxchg.org \
    --cc=kanchana.p.sridhar@intel.com \
    --cc=kasong@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=roman.gushchin@linux.dev \
    --cc=ryan.roberts@arm.com \
    --cc=shakeel.butt@linux.dev \
    --cc=usamaarif642@gmail.com \
    --cc=v-songbaohua@oppo.com \
    --cc=ying.huang@intel.com \
    --cc=yosryahmed@google.com \
    /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