[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <78e45bc6-20ba-48fa-8247-40d745cd7c38@vivo.com>
Date: Thu, 11 Sep 2025 11:04:25 +0800
From: Lei Liu <liulei.rjpt@...o.com>
To: Shakeel Butt <shakeel.butt@...ux.dev>
Cc: Suren Baghdasaryan <surenb@...gle.com>, Michal Hocko <mhocko@...e.com>,
David Rientjes <rientjes@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Kemeng Shi <shikemeng@...weicloud.com>, Kairui Song <kasong@...cent.com>,
Nhat Pham <nphamcs@...il.com>, Baoquan He <bhe@...hat.com>,
Barry Song <baohua@...nel.org>, Chris Li <chrisl@...nel.org>,
Johannes Weiner <hannes@...xchg.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Muchun Song <muchun.song@...ux.dev>, David Hildenbrand <david@...hat.com>,
Lorenzo Stoakes <lorenzo.stoakes@...cle.com>,
"Liam R. Howlett" <Liam.Howlett@...cle.com>, Vlastimil Babka
<vbabka@...e.cz>, Mike Rapoport <rppt@...nel.org>,
Brendan Jackman <jackmanb@...gle.com>, Zi Yan <ziy@...dia.com>,
"Peter Zijlstra (Intel)" <peterz@...radead.org>,
Chen Yu <yu.c.chen@...el.com>, Hao Jia <jiahao1@...iang.com>,
"Kirill A. Shutemov" <kas@...nel.org>, Usama Arif <usamaarif642@...il.com>,
Oleg Nesterov <oleg@...hat.com>, Christian Brauner <brauner@...nel.org>,
Mateusz Guzik <mjguzik@...il.com>, Steven Rostedt <rostedt@...dmis.org>,
Andrii Nakryiko <andrii@...nel.org>, Al Viro <viro@...iv.linux.org.uk>,
Fushuai Wang <wangfushuai@...du.com>,
"open list:MEMORY MANAGEMENT - OOM KILLER" <linux-mm@...ck.org>,
open list <linux-kernel@...r.kernel.org>,
"open list:CONTROL GROUP - MEMORY RESOURCE CONTROLLER (MEMCG)"
<cgroups@...r.kernel.org>
Subject: Re: [PATCH v0 0/2] mm: swap: Gather swap entries and batch async
release
on 2025/9/11 4:12, Shakeel Butt wrote:
> On Wed, Sep 10, 2025 at 10:14:04PM +0800, Lei Liu wrote:
>> On 2025/9/10 3:48, Suren Baghdasaryan wrote:
>>> On Tue, Sep 9, 2025 at 12:21 PM Shakeel Butt <shakeel.butt@...ux.dev> wrote:
>>>> On Tue, Sep 09, 2025 at 02:53:39PM +0800, Lei Liu wrote:
>>>>> 1. Problem Scenario
>>>>> On systems with ZRAM and swap enabled, simultaneous process exits create
>>>>> contention. The primary bottleneck occurs during swap entry release
>>>>> operations, causing exiting processes to monopolize CPU resources. This
>>>>> leads to scheduling delays for high-priority processes.
>>>>>
>>>>> 2. Android Use Case
>>>>> During camera launch, LMKD terminates background processes to free memory.
>>>> How does LMKD trigger the kills? SIGKILL or cgroup.kill?
>>> SIGKILL
>>>
>>>>> Exiting processes compete for CPU cycles, delaying the camera preview
>>>>> thread and causing visible stuttering - directly impacting user
>>>>> experience.
>>>> Since the exit/kill is due to low memory situation, punting the memory
>>>> freeing to a low priority async mechanism will help in improving user
>>>> experience. Most probably the application (camera preview here) will get
>>>> into global reclaim and will compete for CPU with the async memory
>>>> freeing.
>>>>
>>>> What we really need is faster memory freeing and we should explore all
>>>> possible ways. As others suggested fix/improve the bottleneck in the
>>>> memory freeing path. In addition I think we should explore parallelizing
>>>> this as well.
>>>>
>>>> On Android, I suppose most of the memory is associated with single or
>>>> small set of processes and parallelizing memory freeing would be
>>>> challenging. BTW is LMKD using process_mrelease() to release the killed
>>>> process memory?
>>> Yes, LMKD has a reaper thread which wakes up and calls
>>> process_mrelease() after the main LMKD thread issued SIGKILL.
>> Hi Suren
>>
>> our current issue is that after lmkd kills a process,|exit_mm|takes
>> considerable time. The interface you provided might help quickly free
>> memory, potentially allowing us to release some memory from processes before
>> lmkd kills them. This could be a good idea.
>>
>> We will take your suggestion into consideration.
> But LMKD already does the process_mrelease(). Is that not happening on
> your setup?
Hi Shakeel
Thank you for your consideration.
In our product, we have observed that in scenarios where multiple
processes are being killed, the load on the lmkd_reaper thread can
become very heavy, leading to issues with power consumption and lag.
This problem also occurs in the current camera launch scenario.
Best regards,
Lei
Powered by blists - more mailing lists