Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1606949pxb; Mon, 11 Oct 2021 09:21:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1EojXn7ubyHvTd+I04d0NWKLUvVl+j/vpoUtiRG3cs3NpjDjrynEXQwjieCnO5zp00S+R X-Received: by 2002:a05:6402:2787:: with SMTP id b7mr15374429ede.159.1633969313376; Mon, 11 Oct 2021 09:21:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633969313; cv=none; d=google.com; s=arc-20160816; b=IwB9baUwYmtcni8fvJKCTxsAuPlcX9iagEc0fUIba+4G9CXrEpyLGbPiM4hO78/enH 6M/0XUS5/uoNZNlkr0WeWRLDEw6L6vRWIe8NZEvwkFyQCoRINGWj/i6AXFZ3w2LfmNbQ Y+kALffHDnMUAkVT+mSi/ZIa5USM9lQFHYA0Q/ChR3dmhPb1gHiA+Zb+ZoHpMOF2HSUc xCEMu0dQ4z76uInnO2TdZo36tOdgJWDD8SzaBP+gGvEHmm1muHTVJp6IJgy3AdEfGkye UtisnsHWdMv6uQtDbYGOBJ4KsWmvq8SPDQ3FZwrAvyOOvKdO4aquXXL+p1t0n15lJ9KL bl8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Xw+IlCOw0VN11+4gbW0CcFkV8zMbAYmFEqOL5u+s6vo=; b=t9htnwE63407AieFphRik5t6X9O1QQ8/csUGaEKWDntrpLggU9qePvb4slGHTGmm2D YQ9QNUTduGNcseMODfJYdpjGjMTxg4LuqzuygtDeGHHvM79KQ8/X1V0AH6knIPA6zhNg BD21qibbIYt57+azdB9l4mm5bvX+f/n8RyCppPN4PeZxhPNmxYnBgP/Jg/yW4OakR4G8 yKb69BHoCPSRW7x6++4fru1BuguY60h08YkoxkO6nRNLz8CL2AO1PJWfhGvpm6et/N0P Y1gpdPQpAzy0w8SEf9pnxaLq05I4Td6sLeNuaalckZasQgg4ChXKGzuWo2J054cXYhEP lldg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=oek9t6K1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k9si11386474edh.518.2021.10.11.09.21.29; Mon, 11 Oct 2021 09:21:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=oek9t6K1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236143AbhJKLZG (ORCPT + 99 others); Mon, 11 Oct 2021 07:25:06 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:52492 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236114AbhJKLZF (ORCPT ); Mon, 11 Oct 2021 07:25:05 -0400 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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