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 0E068C433EF for ; Mon, 11 Oct 2021 11:23:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2E8C760EB1 for ; Mon, 11 Oct 2021 11:23:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2E8C760EB1 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=suse.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 9DC2A6B006C; Mon, 11 Oct 2021 07:23:06 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 964FB6B0071; Mon, 11 Oct 2021 07:23:06 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 82D16900002; Mon, 11 Oct 2021 07:23:06 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0177.hostedemail.com [216.40.44.177]) by kanga.kvack.org (Postfix) with ESMTP id 7314B6B006C for ; Mon, 11 Oct 2021 07:23:06 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 2E9C88249980 for ; Mon, 11 Oct 2021 11:23:06 +0000 (UTC) X-FDA: 78683919972.02.7D914E4 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf18.hostedemail.com (Postfix) with ESMTP id B87AF4004187 for ; Mon, 11 Oct 2021 11:23:05 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 51AD31FE9C; Mon, 11 Oct 2021 11:23:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1633951384; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Xw+IlCOw0VN11+4gbW0CcFkV8zMbAYmFEqOL5u+s6vo=; b=oek9t6K1RiKpfTX6tBopWgwd3n6/EwyBZJnKr6ToCyP5ri0SKHrqxbbaWEEwFJ3nrq+mOD NTkafHAmMEmGnugMTQVjryBJQWTNC4rlvnR1DdoZVTnpZ//kMXfRWGKaMmPmVeDMOOpVU4 JbsCJY/PLvR9mf8eRghX1hU+TEswqwo= Received: from suse.cz (unknown [10.100.201.86]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id C86B3A3B83; Mon, 11 Oct 2021 11:23:03 +0000 (UTC) Date: Mon, 11 Oct 2021 13:23:00 +0200 From: Michal Hocko To: David Hildenbrand Cc: ultrachin@163.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, brookxu.cn@gmail.com, chen xiaoguang , zeng jingxiang , lu yihui , Claudio Imbrenda , Daniel Jordan Subject: Re: [PATCH] mm: Free per cpu pages async to shorten program exit time Message-ID: References: <20211008063933.331989-1-ultrachin@163.com> <278a6cda-3095-5e27-e136-2765f73bc67d@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <278a6cda-3095-5e27-e136-2765f73bc67d@redhat.com> X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: B87AF4004187 X-Stat-Signature: p63wxsbq9qdd4r1tk9agy5hzimxn7pbu Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=oek9t6K1; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf18.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com X-HE-Tag: 1633951385-344273 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 Mon 11-10-21 11:40:12, David Hildenbrand wrote: > On 11.10.21 11:28, Michal Hocko wrote: > > On Fri 08-10-21 10:17:50, 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. > > > > > > 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. > > > > This is not a new problem. Large process tear down can take ages. The > > primary road block has been accounting. This lot of work has to be > > accounted to the proper domain (e.g. cpu cgroup). > > In general, yes. For some setups where admins don't care about that > accounting (e.g., enabled via some magic toggle for large VMs), I guess this > accounting isn't the major roadblock, correct? Right, I would be careful about magic toggles though. Besides there are ways to achive this in the userspace. We used to have a request to help paralleling process exit from a DB vendor and Vlastimil has come up with a clone(CLONE_VM) and madvise(DONT_NEED) from several threads as a "workaround". This would work properly from the accounting POV. Admittedly a bit of an involved approach though. -- Michal Hocko SUSE Labs