linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Barry Song <21cnbao@gmail.com>
To: Zhiguo Jiang <justinjiang@vivo.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	Will Deacon <will@kernel.org>,
	 "Aneesh Kumar K.V" <aneesh.kumar@kernel.org>,
	Nick Piggin <npiggin@gmail.com>,
	 Peter Zijlstra <peterz@infradead.org>,
	Arnd Bergmann <arnd@arndb.de>,
	 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>,
	linux-arch@vger.kernel.org, cgroups@vger.kernel.org,
	 opensource.kernel@vivo.com
Subject: Re: [PATCH 0/2] mm: tlb swap entries batch async release
Date: Wed, 31 Jul 2024 10:18:49 +0800	[thread overview]
Message-ID: <CAGsJ_4xdnQjQyJVMfN7ZSW3OMvJhFRErjwMGSCDZACQOVWeesw@mail.gmail.com> (raw)
In-Reply-To: <20240730114426.511-1-justinjiang@vivo.com>

On Tue, Jul 30, 2024 at 7:44 PM Zhiguo Jiang <justinjiang@vivo.com> wrote:
>
> The main reasons for the prolonged exit of a background process is the
> time-consuming release of its swap entries. The proportion of swap memory
> occupied by the background process increases with its duration in the
> background, and after a period of time, this value can reach 60% or more.

Do you know the reason? Could they be contending for a cluster lock or
something?
Is there any perf data or flamegraph available here?

> Additionally, the relatively lengthy path for releasing swap entries
> further contributes to the longer time required for the background process
> to release its swap entries.
>
> In the multiple background applications scenario, when launching a large
> memory application such as a camera, system may enter a low memory state,
> which will triggers the killing of multiple background processes at the
> same time. Due to multiple exiting processes occupying multiple CPUs for
> concurrent execution, the current foreground application's CPU resources
> are tight and may cause issues such as lagging.
>
> To solve this problem, we have introduced the multiple exiting process
> asynchronous swap memory release mechanism, which isolates and caches
> swap entries occupied by multiple exit processes, and hands them over
> to an asynchronous kworker to complete the release. This allows the
> exiting processes to complete quickly and release CPU resources. We have
> validated this modification on the products and achieved the expected
> benefits.
>
> It offers several benefits:
> 1. Alleviate the high system cpu load caused by multiple exiting
>    processes running simultaneously.
> 2. Reduce lock competition in swap entry free path by an asynchronous

 Do you have data on which lock is affected? Could it be a cluster lock?

>    kworker instead of multiple exiting processes parallel execution.
> 3. Release memory occupied by exiting processes more efficiently.
>
> Zhiguo Jiang (2):
>   mm: move task_is_dying to h headfile
>   mm: tlb: multiple exiting processes's swap entries async release
>
>  include/asm-generic/tlb.h |  50 +++++++
>  include/linux/mm_types.h  |  58 ++++++++
>  include/linux/oom.h       |   6 +
>  mm/memcontrol.c           |   6 -
>  mm/memory.c               |   3 +-
>  mm/mmu_gather.c           | 297 ++++++++++++++++++++++++++++++++++++++
>  6 files changed, 413 insertions(+), 7 deletions(-)
>  mode change 100644 => 100755 include/asm-generic/tlb.h
>  mode change 100644 => 100755 include/linux/mm_types.h
>  mode change 100644 => 100755 include/linux/oom.h
>  mode change 100644 => 100755 mm/memcontrol.c
>  mode change 100644 => 100755 mm/memory.c
>  mode change 100644 => 100755 mm/mmu_gather.c

Can you check your local filesystem to determine why you're running
the chmod command?

>
> --
> 2.39.0
>

Thanks
Barry


  parent reply	other threads:[~2024-07-31  2:19 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-30 11:44 [PATCH 0/2] mm: tlb swap entries batch async release Zhiguo Jiang
2024-07-30 11:44 ` [PATCH 1/2] mm: move task_is_dying to h headfile Zhiguo Jiang
2024-07-30 11:44 ` [PATCH 2/2] mm: tlb: add tlb swap entries batch async release Zhiguo Jiang
2024-07-31  9:55   ` kernel test robot
2024-07-31 13:42     ` zhiguojiang
2024-07-31 11:49   ` kernel test robot
2024-07-31 12:08   ` Arnd Bergmann
2024-07-31 13:47     ` zhiguojiang
2024-07-31 18:19   ` kernel test robot
2024-08-01  6:54     ` zhiguojiang
2024-07-31  2:18 ` Barry Song [this message]
2024-07-31  4:56   ` [PATCH 0/2] mm: " zhiguojiang

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_4xdnQjQyJVMfN7ZSW3OMvJhFRErjwMGSCDZACQOVWeesw@mail.gmail.com \
    --to=21cnbao@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@kernel.org \
    --cc=arnd@arndb.de \
    --cc=cgroups@vger.kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=justinjiang@vivo.com \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=muchun.song@linux.dev \
    --cc=npiggin@gmail.com \
    --cc=opensource.kernel@vivo.com \
    --cc=peterz@infradead.org \
    --cc=roman.gushchin@linux.dev \
    --cc=shakeel.butt@linux.dev \
    --cc=will@kernel.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;
as well as URLs for NNTP newsgroup(s).