From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 36528ECE564 for ; Tue, 10 Sep 2024 08:52:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9BD008D0034; Tue, 10 Sep 2024 04:52:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 96BE48D0002; Tue, 10 Sep 2024 04:52:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7BDE08D0034; Tue, 10 Sep 2024 04:52:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 57A588D0002 for ; Tue, 10 Sep 2024 04:52:44 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id BF5FFA799A for ; Tue, 10 Sep 2024 08:52:43 +0000 (UTC) X-FDA: 82548213006.06.4B1E820 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf07.hostedemail.com (Postfix) with ESMTP id 8596F4000A for ; Tue, 10 Sep 2024 08:52:40 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KDbk3nEl; spf=pass (imf07.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725958259; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=POdK7rwP2ePW+Rz+hlQVNeor7wIIfaUqhLki0c8++Oc=; b=B/KoWgjLPyop6vzl4SaM/P6SxVSqA/F5RAGcHy8ZgwCo0cqahqATic8k8apeK2phiBLVZ1 JiXtjyopQU2/pye6n87tvoalnIBt5CP1OhIzNkdr+sLi/1dsPXb82joF+YxqkwPGyxqovZ 962m1IhqkQ5FZqul3NK4RwNgVNu02Wc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725958259; a=rsa-sha256; cv=none; b=coR2M1Q3P4l/p04ANgmrpM8ODgddH+ei0UdD9m66rOO6nLdEQk9lUrWXKLtxYd1SCrmzf2 e3IUdAIhg/cN0IVo1QeSEluZNCKUeS0xZD08n1ycIhB8DtPgTSoHXlOPYR9axDTgp1f1RK fExWz0lqBBYnKwYJx0TPZh4zRbGbm0g= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=KDbk3nEl; spf=pass (imf07.hostedemail.com: domain of david@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725958359; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=POdK7rwP2ePW+Rz+hlQVNeor7wIIfaUqhLki0c8++Oc=; b=KDbk3nElWZ3KmVNzp5ujmriUiJUpcvgi7XdhxRHBl/GIbkCfFqbjfwkT2WCBz5VOG00KdL hG/dw0aAmx/u0PXuzpUg5ndgbKeOB4WsjwZZ5CmHz8o6gYG8SFk2UsqXibyWUCq1yCb8QQ YGDL4uvux5sJEVvgLCtIIza89RwiNzU= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-350-GozTozxeNUaGaZxN5yc8uA-1; Tue, 10 Sep 2024 04:52:38 -0400 X-MC-Unique: GozTozxeNUaGaZxN5yc8uA-1 Received: by mail-wm1-f71.google.com with SMTP id 5b1f17b1804b1-42cb830ea86so3886815e9.3 for ; Tue, 10 Sep 2024 01:52:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725958357; x=1726563157; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=POdK7rwP2ePW+Rz+hlQVNeor7wIIfaUqhLki0c8++Oc=; b=c6ixD79ePaSAVaEMg7sLVGt2aXaHbAucLxRwObK7Ox5p1KXBj8Ld/BfN3EcbMVcs7m EFLiQ1yyKDRnfJBFuX0TuGUc2XDeDsp78BdpCqnj+E/4CEwqUwDfz5E2CVyIcdFWdEpB Vxq+WJAjWUVyzkEgRxF/SvvySgdoVQktNiLZyVgN1VnbogdvLSeOuajntULRChbgBOHL cNW7iyhR/Tq6A7yRVA28OCVwr++O9e9feB4SYgJwnQeCNNDTd8gt4W+PiO7/BnNRe7D6 88f1v5ETjbKpVF7869Y1XNhJrPGW08l02TbKG7r7BoM+/ibLxRmkEEBC9Qtw3QDKHqpW wZXg== X-Forwarded-Encrypted: i=1; AJvYcCXPdJkvj55ZEs3GzeIbSXv5sd4eu4MOeZXNaHJuN8jhibhw3SpcwxL7p1JtkQx1b9W7MLKONRMmDg==@kvack.org X-Gm-Message-State: AOJu0YwKgygI8uRgTlNTzBV455qlChZB8g1SIb+xOwksBtroxo8lSTFt rgwCAA16Eg5pVmeOX2zSVHCVXb5rTfN1W5tiqfTb+qOcE1sSosZe6Gt6a/A78XjyoUpnp2bk6FP 5CoQeBXyxYhWiO5GWRwS/mLUQOnUkJUWnik9ViKdNK8FkCYdn X-Received: by 2002:a05:600c:3b83:b0:42c:b750:19f3 with SMTP id 5b1f17b1804b1-42cb7501f19mr45524655e9.0.1725958357211; Tue, 10 Sep 2024 01:52:37 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHwK1Rg01AQOjspOZTs9gjVEcb3jrUzNvo3+pKRcFiZUzVKUeeceXGgDBBDBpymREgFKMb7/g== X-Received: by 2002:a05:600c:3b83:b0:42c:b750:19f3 with SMTP id 5b1f17b1804b1-42cb7501f19mr45524015e9.0.1725958355995; Tue, 10 Sep 2024 01:52:35 -0700 (PDT) Received: from ?IPV6:2003:cb:c706:b600:cfda:b383:a116:a940? (p200300cbc706b600cfdab383a116a940.dip0.t-ipconnect.de. [2003:cb:c706:b600:cfda:b383:a116:a940]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42caeb21a68sm103937695e9.8.2024.09.10.01.52.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 10 Sep 2024 01:52:35 -0700 (PDT) Message-ID: Date: Tue, 10 Sep 2024 10:52:34 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/2] mm: tlb: add tlb swap entries batch async release To: Barry Song <21cnbao@gmail.com>, zhiguojiang Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Will Deacon , "Aneesh Kumar K.V" , Nick Piggin , Peter Zijlstra , Arnd Bergmann , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , linux-arch@vger.kernel.org, cgroups@vger.kernel.org, opensource.kernel@vivo.com References: <20240805153639.1057-1-justinjiang@vivo.com> <20240805153639.1057-3-justinjiang@vivo.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/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frf4Gusdqx8nPEpfOqCtbbwJMATbHyqLt7/oz/5deGuwxgb65pWIzufa N7eop7uh+6bezi+rugUI+w6DABEBAAHCwXwEGAEIACYCGwwWIQQb2cqtc1xMOkYN/MpN3hD3 AP+DWgUCXw7HsgUJEqkpoQAKCRBN3hD3AP+DWrrpD/4qS3dyVRxDcDHIlmguXjC1Q5tZTwNB boaBTPHSy/Nksu0eY7x6HfQJ3xajVH32Ms6t1trDQmPx2iP5+7iDsb7OKAb5eOS8h+BEBDeq 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 8596F4000A X-Stat-Signature: 4ty3uyudc9z787wj3bjwz6ok1eny9ui4 X-Rspamd-Server: rspam09 X-Rspam-User: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xTUMdbZicREE3/cw16LpScYtXkxryQZhQxEO1hWP1zI4e6mh27JlDaInTkjX0gtZloO5rc3+C8IxZ6dGsl/qTtafssOLvRp2lKgstmQmhNBykeCDqjnIx4et8hokcU5G44oJr5a+F/NCP28FYAW99VtvPHxr3weUpADoqQCaPm6Ucf+OyZXVgd7ZY90iHKNSHjK7rpKHbm9+4oZ2Q0YdRTb8ng9ADOfuhYTVwutO9yu11NXKTioNPyFFNTTP5xHS+DK89uQyjmIP9BbGHYwP9wZnR9sskrWpTAxgamoUtx1/hVSe98lbKh3SglmZo2DaCAUQt4VOKnaAI2wluo2BtlgnDZGRQzg6sJdzDeLGNTNw1unf+bcO9VFKZ+i72GfccwKcRe1cjBx6t5 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On 10.09.24 06:22, Barry Song wrote: > On Tue, Sep 10, 2024 at 2:44 AM zhiguojiang wrote: >> >> >> >> 在 2024/9/9 14:49, David Hildenbrand 写道: >>> On 05.08.24 17:36, Zhiguo Jiang wrote: >>>> One of the main reasons for the prolonged exit of the process with >>>> independent mm is the time-consuming release of its swap entries. >>>> The proportion of swap memory occupied by the process increases over >>>> time due to high memory pressure triggering to reclaim anonymous folio >>>> into swapspace, e.g., in Android devices, we found this proportion can >>>> reach 60% or more after a period of time. Additionally, the relatively >>>> lengthy path for releasing swap entries further contributes to the >>>> longer time required to release swap entries. >>>> >>>> Testing Platform: 8GB RAM >>>> Testing procedure: >>>> After booting up, start 15 processes first, and then observe the >>>> physical memory size occupied by the last launched process at different >>>> time points. >>>> Example: The process launched last: com.qiyi.video >>>> | memory type | 0min | 1min | 5min | 10min | 15min | >>>> ------------------------------------------------------------------- >>>> | VmRSS(KB) | 453832 | 252300 | 204364 | 199944 | 199748 | >>>> | RssAnon(KB) | 247348 | 99296 | 71268 | 67808 | 67660 | >>>> | RssFile(KB) | 205536 | 152020 | 132144 | 131184 | 131136 | >>>> | RssShmem(KB) | 1048 | 984 | 952 | 952 | 952 | >>>> | VmSwap(KB) | 202692 | 334852 | 362880 | 366340 | 366488 | >>>> | Swap ratio(%) | 30.87% | 57.03% | 63.97% | 64.69% | 64.72% | >>>> Note: min - minute. >>>> >>>> When there are multiple processes with independent mm and the high >>>> memory pressure in system, if the large memory required process is >>>> launched at this time, system will is likely to trigger the >>>> instantaneous >>>> killing of many processes with independent mm. Due to multiple exiting >>>> processes occupying multiple CPU core resources for concurrent >>>> execution, >>>> leading to some issues such as the current non-exiting and important >>>> processes lagging. >>>> >>>> To solve this problem, we have introduced the multiple exiting process >>>> asynchronous swap entries release mechanism, which isolates and caches >>>> swap entries occupied by multiple exiting 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 Android products and achieved the >>>> expected benefits. >>>> >>>> Testing Platform: 8GB RAM >>>> Testing procedure: >>>> After restarting the machine, start 15 app processes first, and then >>>> start the camera app processes, we monitor the cold start and preview >>>> time datas of the camera app processes. >>>> >>>> Test datas of camera processes cold start time (unit: millisecond): >>>> | seq | 1 | 2 | 3 | 4 | 5 | 6 | average | >>>> | before | 1498 | 1476 | 1741 | 1337 | 1367 | 1655 | 1512 | >>>> | after | 1396 | 1107 | 1136 | 1178 | 1071 | 1339 | 1204 | >>>> >>>> Test datas of camera processes preview time (unit: millisecond): >>>> | seq | 1 | 2 | 3 | 4 | 5 | 6 | average | >>>> | before | 267 | 402 | 504 | 513 | 161 | 265 | 352 | >>>> | after | 188 | 223 | 301 | 203 | 162 | 154 | 205 | >>>> >>>> Base on the average of the six sets of test datas above, we can see that >>>> the benefit datas of the modified patch: >>>> 1. The cold start time of camera app processes has reduced by about 20%. >>>> 2. The preview time of camera app processes has reduced by about 42%. >>>> >>>> It offers several benefits: >>>> 1. Alleviate the high system cpu loading caused by multiple exiting >>>> processes running simultaneously. >>>> 2. Reduce lock competition in swap entry free path by an asynchronous >>>> kworker instead of multiple exiting processes parallel execution. >>>> 3. Release pte_present memory occupied by exiting processes more >>>> efficiently. >>>> >>>> Signed-off-by: Zhiguo Jiang >>>> --- >>>> arch/s390/include/asm/tlb.h | 8 + >>>> include/asm-generic/tlb.h | 44 ++++++ >>>> include/linux/mm_types.h | 58 +++++++ >>>> mm/memory.c | 3 +- >>>> mm/mmu_gather.c | 296 ++++++++++++++++++++++++++++++++++++ >>>> 5 files changed, 408 insertions(+), 1 deletion(-) >>>> >>>> diff --git a/arch/s390/include/asm/tlb.h b/arch/s390/include/asm/tlb.h >>>> index e95b2c8081eb..3f681f63390f >>>> --- a/arch/s390/include/asm/tlb.h >>>> +++ b/arch/s390/include/asm/tlb.h >>>> @@ -28,6 +28,8 @@ static inline bool __tlb_remove_page_size(struct >>>> mmu_gather *tlb, >>>> struct page *page, bool delay_rmap, int page_size); >>>> static inline bool __tlb_remove_folio_pages(struct mmu_gather *tlb, >>>> struct page *page, unsigned int nr_pages, bool delay_rmap); >>>> +static inline bool __tlb_remove_swap_entries(struct mmu_gather *tlb, >>>> + swp_entry_t entry, int nr); >>> >>> >>> The problem I am having is that swap entries don't have any >>> intersection with the TLB. It sounds like we're squeezing something >>> into an existing concept (MMU gather) that just doesn't belong in there. >> I referred to the mechanism of batch release in tlb, and perhaps a new >> structure needs to be created to implement this feature. > > We already use swap_slots_cache to collect multiple swap entries and > free them in > batches. Would it be better to incorporate our new logic there? Yes, very likely. might > be much less > change and don't need to touch zap_pte_range() ? for example, while slot_caches > are almost full, wake up the async thread to free? FWIW, the async part over-complicates the whole thing. I agree that if possible, we should try to avoid it; maybe it's not easily possible. -- Cheers, David / dhildenb