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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89BD6C433F5 for ; Fri, 8 Oct 2021 12:38:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 0AF3F60F9D for ; Fri, 8 Oct 2021 12:38:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 0AF3F60F9D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 7BFA96B0071; Fri, 8 Oct 2021 08:38:18 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 770066B0072; Fri, 8 Oct 2021 08:38:18 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 637E7900002; Fri, 8 Oct 2021 08:38:18 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0053.hostedemail.com [216.40.44.53]) by kanga.kvack.org (Postfix) with ESMTP id 547646B0071 for ; Fri, 8 Oct 2021 08:38:18 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 10A4C1812C265 for ; Fri, 8 Oct 2021 12:38:18 +0000 (UTC) X-FDA: 78673223076.26.37C011A Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf13.hostedemail.com (Postfix) with ESMTP id 864DF103D4D2 for ; Fri, 8 Oct 2021 12:38:17 +0000 (UTC) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3D1F82012F; Fri, 8 Oct 2021 12:38:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1633696696; h=from:from:reply-to: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; bh=gq+hip/cz9+KCMolU9vZOYoItZXwsILEnNojNwcDp8k=; b=uW3JT+Khkp3ErXS1Gq2aBdPYB9JfAHAk6xGe1WjOAb51bvrciH7OuwSG/bu5LoOviykZS9 zpbZQT1YEvyN+IBtkpvfaFKkJadolxIFIqosfgz/Tzv2wF9TRzIq4aNR72dc7Qy+/mb4z7 SgEIqT+4QxUwctL8aRcV1KIsOIZBAig= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1633696696; h=from:from:reply-to: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; bh=gq+hip/cz9+KCMolU9vZOYoItZXwsILEnNojNwcDp8k=; b=3kPX6+yvOVMNHdLxsRtMTm0vlsmARA0BjJLTC+OvCMjwJJwfa63rwX/pvfQEX81S//okpj fLiKbsbXm0e6KIDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1A56E13ECA; Fri, 8 Oct 2021 12:38:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id B5LRBbg7YGHTVgAAMHmgww (envelope-from ); Fri, 08 Oct 2021 12:38:16 +0000 Message-ID: <8f30837b-5186-e836-21bc-9964456400c1@suse.cz> Date: Fri, 8 Oct 2021 14:38:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH] mm: Free per cpu pages async to shorten program exit time Content-Language: en-US To: David Hildenbrand , ultrachin@163.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: brookxu.cn@gmail.com, chen xiaoguang , zeng jingxiang , lu yihui , Claudio Imbrenda References: <20211008063933.331989-1-ultrachin@163.com> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 864DF103D4D2 X-Stat-Signature: prcecpf6pkwhnad6r6zhueo6fi8srz1g Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b=uW3JT+Kh; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=3kPX6+yv; dmarc=none; spf=pass (imf13.hostedemail.com: domain of vbabka@suse.cz designates 195.135.220.29 as permitted sender) smtp.mailfrom=vbabka@suse.cz X-HE-Tag: 1633696697-601759 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: On 10/8/21 10:17, David Hildenbrand wrote: > On 08.10.21 08:39, ultrachin@163.com wrote: >> From: chen xiaoguang >> >> The exit time is long when program allocated big memory and >> the most time consuming part is free memory which takes 99.9% >> of the total exit time. By using async free we can save 25% of >> exit time. >> >> Signed-off-by: chen xiaoguang >> Signed-off-by: zeng jingxiang >> Signed-off-by: lu yihui > > I recently discussed with Claudio if it would be possible to tear down the > process MM deferred, because for some use cases (secure/encrypted > virtualization, very large mmaps) tearing down the page tables is already > the much more expensive operation. OK, but what exactly is the benefit here? The cpu time will have to be spent in any case, but we move it to a context that's not accounted to the exiting process. Is that good? Also if it's a large process and restarts immediately, allocating all the memory back again, it might not be available as it's still being freed in the background, leading to a risk of OOM? > There is mmdrop_async(), and I wondered if one could reuse that concept when > tearing down a process -- I didn't look into feasibility, however, so it's > just some very rough idea. >