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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id BC792C433F5 for ; Tue, 26 Apr 2022 06:59:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4BEC16B0075; Tue, 26 Apr 2022 02:59:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 446D66B0078; Tue, 26 Apr 2022 02:59:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2E7D76B007B; Tue, 26 Apr 2022 02:59:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.a.hostedemail.com [64.99.140.24]) by kanga.kvack.org (Postfix) with ESMTP id 18ADB6B0075 for ; Tue, 26 Apr 2022 02:59:34 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E2BBC60974 for ; Tue, 26 Apr 2022 06:59:33 +0000 (UTC) X-FDA: 79398129426.14.EA85B14 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by imf29.hostedemail.com (Postfix) with ESMTP id D3EFD120047 for ; Tue, 26 Apr 2022 06:59:30 +0000 (UTC) Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id ADF3B1F388; Tue, 26 Apr 2022 06:59:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1650956371; 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=dQZAfakINXXUF6QkmKLshpcGVsJFPzKHe9GL9BtpKHQ=; b=gCaf9t121tHQp1fEYxinnaNc7/2/j88so7AtrAFXPKKCZKHFB15rIc0owCHyFx+J7ojKCy aXivEz47i1AhOBwwKe+ytyEcoOJ+8hqqjtifEmWnraD/Yb7gfZodnr2Chyz2YxDjZziKLU TVGMsvLaRRGTbV3wfG3YGche3u1h1h0= 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 601DC2C149; Tue, 26 Apr 2022 06:59:31 +0000 (UTC) Date: Tue, 26 Apr 2022 08:59:29 +0200 From: Michal Hocko To: Nico Pache Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, David Rientjes , Andrea Arcangeli Subject: Re: [RFC 3/3] exit: Check for MMF_OOM_SKIP in exit_mmap Message-ID: References: <20220421190533.1601879-1-npache@redhat.com> <20220421190533.1601879-4-npache@redhat.com> <19303483-5700-fb6e-ba4a-398913370100@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <19303483-5700-fb6e-ba4a-398913370100@redhat.com> X-Stat-Signature: px3z7awt98iqynbixzt4kyns8gcbwszt X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: D3EFD120047 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=gCaf9t12; spf=pass (imf29.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.29 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com X-Rspam-User: X-HE-Tag: 1650956370-253133 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 25-04-22 15:00:24, Nico Pache wrote: > > > On 4/22/22 11:38, Michal Hocko wrote: > > On Thu 21-04-22 15:05:33, Nico Pache wrote: > >> The MMF_OOM_SKIP bit is used to indicate weather a mm_struct can not be > >> invalided or has already been invalided. exit_mmap currently calls > >> __oom_reap_task_mm unconditionally despite the fact that the oom reaper > >> may have already called this. > >> > >> Add a check for the MMF_OOM_SKIP bit being set in exit_mmap to avoid > >> unnessary calls to the invalidate code. > > > > Why do we care about this? > Is there no cost to the MMU/TLB invalidation? The MMU notifier contains a lock > too so perhaps we can also avoids some unnecessary MMU notifier lock contention. I am pretty sure that this area can be micro optimized but I do not really see a strong reason for that. OOM victims are/should be really rare so I do not think that any performance optimization would be really visible. If you want to improve the code then I think a much better plan would be to get rid of the whole oom special case altogether. This might be much closer than ever after Hugh's recent m{un}lock changes. I didn't have time to think that through though. I believe Suren Baghdasaryan has been looking into that as well. -- Michal Hocko SUSE Labs