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 A8E66C433FE for ; Mon, 1 Nov 2021 08:37:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2F59F610EA for ; Mon, 1 Nov 2021 08:37:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 2F59F610EA 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 678E094000B; Mon, 1 Nov 2021 04:37:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 62924940008; Mon, 1 Nov 2021 04:37:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F0A994000B; Mon, 1 Nov 2021 04:37:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0195.hostedemail.com [216.40.44.195]) by kanga.kvack.org (Postfix) with ESMTP id 3DAEC940008 for ; Mon, 1 Nov 2021 04:37:55 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id E365B1802A378 for ; Mon, 1 Nov 2021 08:37:54 +0000 (UTC) X-FDA: 78759708468.26.BE18F71 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf19.hostedemail.com (Postfix) with ESMTP id 59EE0B0000A7 for ; Mon, 1 Nov 2021 08:37:48 +0000 (UTC) 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: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 59EE0B0000A7 X-Stat-Signature: pux1rwzq6mfgju9j39nn3nbq4yrctnkx Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=HzgQDpTb; spf=pass (imf19.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-HE-Tag: 1635755868-336063 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 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