Received: by 2002:a05:6602:2086:0:0:0:0 with SMTP id a6csp3346452ioa; Tue, 26 Apr 2022 01:43:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNHWmsZgyf14G1cqc1odAfJPSy/ctC4GJn6lliJuzhvMT1KjubyZQTLHuNZHASqKmH3ylF X-Received: by 2002:a17:907:9605:b0:6e8:2f22:b0d4 with SMTP id gb5-20020a170907960500b006e82f22b0d4mr20682627ejc.129.1650962631145; Tue, 26 Apr 2022 01:43:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650962631; cv=none; d=google.com; s=arc-20160816; b=ZotqEdeLx7R6x57YvMuyDgzxmfxWhWC74h3RfsCqQr5uYjROcf2GtkqQRsA/5hw+si m5zXLXsSMBXMVtgWUUPpfa9Q8Dj1NEXZBzudqLOMvrjtwETJ4sBhRwOM+erenpoHLZHx ZRhu9A+2D/gPutdsAVHUKszGyZM72o3u2s0E1MNWZJsYkLb9ZrPd7xtaLXhhtzcFReVe k/WAhPu6Dchvbal+2EcASMG4lEV1lZagoT6jMNIeUdEtP1Upyb9H9En/cXwmSAuL5VJY Qq9+UIY8nBBfvzrnlBtwEHub86qwOJMAm18ZKDGiq+pvkHQkwQFmL1mFxH39bnULU2PZ 90ZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dQZAfakINXXUF6QkmKLshpcGVsJFPzKHe9GL9BtpKHQ=; b=xV7pcNt8VJo/aKFQNw3ZACJjmav6sqIBuHJzY/zOCI2dNea4wfc6o4gmlcCWYW0YKV GRAMiuxd2Sqe+Np2+BmR/o6yktQAh3EgP+Xdc16ZBYXTAkcRy8LazzdXQ6bQ8AaxivkD J08SUlTcjE1LFjd/R5abD07xT/EmEOxdPEtAqLrD/pM15TshVyza9nozmOw7Nki/7L95 mX/5M+1nsXeQIN7kc2q7GwxV5ot93izkhUBhbnP0ycb7rrbXo4m4sroln71e0hb3D2KQ fHyAOwggjfoWZlsxJUZYZ7M73Z03OhCU1/IDPU32lzjfDEXlkX4EL5/TrpKla7YGWgHv s+Yg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=gCaf9t12; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cu17-20020a170906e01100b006e878a53334si14706287ejb.363.2022.04.26.01.43.27; Tue, 26 Apr 2022 01:43:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=gCaf9t12; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343564AbiDZHCn (ORCPT + 99 others); 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> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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