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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DD60BC433FE for ; Tue, 26 Apr 2022 06:59:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343570AbiDZHCn (ORCPT ); Tue, 26 Apr 2022 03:02:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343552AbiDZHCk (ORCPT ); Tue, 26 Apr 2022 03:02:40 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 31A4C60055 for ; Mon, 25 Apr 2022 23:59:33 -0700 (PDT) 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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