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 A1FEFC4332F for ; Mon, 1 Nov 2021 08:37:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 821E661038 for ; Mon, 1 Nov 2021 08:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231693AbhKAIk2 (ORCPT ); Mon, 1 Nov 2021 04:40:28 -0400 Received: from smtp-out1.suse.de ([195.135.220.28]:43170 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231223AbhKAIk1 (ORCPT ); Mon, 1 Nov 2021 04:40:27 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out1.suse.de (Postfix) with ESMTP id 15DA0218B5; Mon, 1 Nov 2021 08:37:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1635755873; 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=XEk3a5ycM/6Z3eTDoA+OxlibhFeAVcniDJrpsbt1oNM=; b=HzgQDpTbMUYIp/F/gANRfnX40aWO52VT8TZvHHbN13yX3H3yq3DrPcDQ1O6M2rz2036ip4 GdFLVrnFW6LNig5oIHXZh7l12VAEn/anqJHpAcdtukUXj6ObtIbZxWSInR2C+UxSxo8SCE z9CwEXS6ybHBykW9sUydxfFIwNpcAVI= 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 86EA9A3B88; Mon, 1 Nov 2021 08:37:52 +0000 (UTC) Date: Mon, 1 Nov 2021 09:37:52 +0100 From: Michal Hocko To: Suren Baghdasaryan Cc: Andrew Morton , David Rientjes , Matthew Wilcox , Johannes Weiner , Roman Gushchin , Rik van Riel , Minchan Kim , Christian Brauner , Christoph Hellwig , Oleg Nesterov , David Hildenbrand , Jann Horn , Shakeel Butt , Andy Lutomirski , Christian Brauner , Florian Weimer , Jan Engelhardt , Linux API , linux-mm , LKML , kernel-team , "Kirill A. Shutemov" , Andrea Arcangeli Subject: Re: [PATCH 1/1] mm: prevent a race between process_mrelease and exit_mmap Message-ID: References: <20211022014658.263508-1-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 29-10-21 09:07:39, Suren Baghdasaryan wrote: > On Fri, Oct 29, 2021 at 6:03 AM Michal Hocko wrote: [...] > > Well, I still do not see why that is a problem. This syscall is meant to > > release the address space not to do it fast. > > It's the same problem for a userspace memory reaper as for the > oom-reaper. The goal is to release the memory of the victim and to > quickly move on to the next one if needed. The purpose of the oom_reaper is to _guarantee_ a forward progress. It doesn't have to be quick or optimized for speed. [...] > > Btw. the above code will not really tell you much on a larger machine > > unless you manage to trigger mmap_sem contection. Otherwise you are > > measuring the mmap_sem writelock fast path and that should be really > > within a noise comparing to the whole address space destruction time. If > > that is not the case then we have a real problem with the locking... > > My understanding of that discussion is that the concern was that even > taking uncontended mmap_sem writelock would regress the exit path. > That was what I wanted to confirm. Am I misreading it? No, your reading match my recollection. I just think that code robustness in exchange of a rw semaphore write lock fast path is a reasonable price to pay even if that has some effect on micro benchmarks. -- Michal Hocko SUSE Labs