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 E6633C433F5 for ; Fri, 8 Oct 2021 12:55:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 7BC6A60FC2 for ; Fri, 8 Oct 2021 12:55:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 7BC6A60FC2 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id E63056B0071; Fri, 8 Oct 2021 08:55:50 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DEB38900002; Fri, 8 Oct 2021 08:55:50 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C8C3C6B0073; Fri, 8 Oct 2021 08:55:50 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0166.hostedemail.com [216.40.44.166]) by kanga.kvack.org (Postfix) with ESMTP id B96F66B0071 for ; Fri, 8 Oct 2021 08:55:50 -0400 (EDT) Received: from smtpin14.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 776E718288128 for ; Fri, 8 Oct 2021 12:55:50 +0000 (UTC) X-FDA: 78673267260.14.1742171 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf27.hostedemail.com (Postfix) with ESMTP id 1C6947016DA8 for ; Fri, 8 Oct 2021 12:55:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633697749; 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; bh=FMmWc8lP0mifWAbwIJadUVhVPm7Gb5Eb+P29xKmImcg=; b=K61i7Sk2Op42cS/TTlauxXClXnyjfXaEy3+bdpnctNVFvQpAmHk+tAa5wjjd/G/f4XMpnb KKRvbBHanJfI9xHwD9CnWCmt1W1gIVdkSxfTbUu8uMllEQ8SuxLNyKsZ4TG3teec/vf7Hz 80W3+SHaecI50Jxn2XytK8D7REub1EQ= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-528-9uQO0W0CMfi5MVuv7LvrTA-1; Fri, 08 Oct 2021 08:55:48 -0400 X-MC-Unique: 9uQO0W0CMfi5MVuv7LvrTA-1 Received: by mail-wr1-f69.google.com with SMTP id c4-20020a5d6cc4000000b00160edc8bb28so1455602wrc.9 for ; Fri, 08 Oct 2021 05:55:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:to:cc:references:from:organization:subject :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=FMmWc8lP0mifWAbwIJadUVhVPm7Gb5Eb+P29xKmImcg=; b=mTDX0K2ruefjJFLHa712vq+fHcnAQMXceCw2Bh835hTPjX+VD+W9OvXajkTDz+Xbjj jjNHlLFbXVThyvmC8TDvdMK4JIUmU4NVEX/vT0iomh7uSawQ5RPLCc4XquYXiDWQiEbi g+ya1cRdhJIqyDIeG8PTrOWL9hRIt7/vTZv24v2M7Ecpkjft/w9YCB7xNhPns4Ej8U2W SDAJtTERWhcrAFBJEcf2tyKhTbS8CPTkPHSC41mOMpM/y1Jyf/2B5RwUqhx9ig9QVxvf Igdzq2Haz+mzBYntlUj4I3GW7pGKj0cDPlXEijuncqVHuqN65kmt26HX8MfxmkLnq/UF TBOA== X-Gm-Message-State: AOAM532Yhiqls4swTU8fS8kKeSeIS1I3mnOSFYUMDIUNqkvGWuiZxdeA wKx/IMpG9XL+MDC2wacXOWVTUQHJtueaBvQTT0i5xeaZv9fmeDZRA9QuEZ+73s2OQp0J0jHSbvm xoIG9YKBOIyM= X-Received: by 2002:a1c:4e12:: with SMTP id g18mr1822936wmh.63.1633697747271; Fri, 08 Oct 2021 05:55:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHJmLzWnslN0Z+MPScYs/aX2KbjkWc8epVby1UyfSSPzG/6fOO7PspP4jDvg5IMfhCG+zbzg== X-Received: by 2002:a1c:4e12:: with SMTP id g18mr1822896wmh.63.1633697746991; Fri, 08 Oct 2021 05:55:46 -0700 (PDT) Received: from [192.168.3.132] (p5b0c676e.dip0.t-ipconnect.de. [91.12.103.110]) by smtp.gmail.com with ESMTPSA id k17sm2458539wrq.7.2021.10.08.05.55.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 08 Oct 2021 05:55:46 -0700 (PDT) To: Vlastimil Babka , 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> <8f30837b-5186-e836-21bc-9964456400c1@suse.cz> From: David Hildenbrand Organization: Red Hat Subject: Re: [PATCH] mm: Free per cpu pages async to shorten program exit time Message-ID: <0ab1dd42-8869-5b41-3af5-e16a49335df2@redhat.com> Date: Fri, 8 Oct 2021 14:55:45 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <8f30837b-5186-e836-21bc-9964456400c1@suse.cz> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US X-Rspamd-Queue-Id: 1C6947016DA8 X-Stat-Signature: dyht313e8prf5a49urtes5amhjbdi8wn Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=K61i7Sk2; spf=none (imf27.hostedemail.com: domain of david@redhat.com has no SPF policy when checking 170.10.133.124) smtp.mailfrom=david@redhat.com; dmarc=pass (policy=none) header.from=redhat.com X-Rspamd-Server: rspam06 X-HE-Tag: 1633697749-774636 Content-Transfer-Encoding: quoted-printable 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 08.10.21 14:38, Vlastimil Babka wrote: > 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 alre= ady >> the much more expensive operation. >=20 > 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 ex= iting > process. Is that good? Also if it's a large process and restarts > immediately, allocating all the memory back again, it might not be avai= lable > as it's still being freed in the background, leading to a risk of OOM? One use case I was told is that if you have a large (secure/encrypted)=20 VM and shut it down, it might take quite a long time until you can=20 actually start that very VM again, because tooling assumes that the VM=20 isn't shut down until the process is gone (closed all files, sockets, etc= .). I also discussed the risk of OOM with Claudio. In some cases, we don't=20 care, for example, we could start the VM on a different node in the=20 cluster, or there is sufficient memory available to start it on the same=20 node. But there was the idea to stop the OOM killer from firing as long=20 as there is still some MM getting cleaned up, which would also make=20 sense to some degree. --=20 Thanks, David / dhildenb