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 96F43C433EF for ; Thu, 11 Nov 2021 15:09:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 15D3861108 for ; Thu, 11 Nov 2021 15:09:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 15D3861108 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id AA9036B0072; Thu, 11 Nov 2021 10:09:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A55D56B0074; Thu, 11 Nov 2021 10:09:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F7916B0075; Thu, 11 Nov 2021 10:09:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0165.hostedemail.com [216.40.44.165]) by kanga.kvack.org (Postfix) with ESMTP id 81FB96B0072 for ; Thu, 11 Nov 2021 10:09:19 -0500 (EST) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 466CF84A0A for ; Thu, 11 Nov 2021 15:09:19 +0000 (UTC) X-FDA: 78796982838.28.80A2342 Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) by imf27.hostedemail.com (Postfix) with ESMTP id C8CE070009C5 for ; Thu, 11 Nov 2021 15:09:14 +0000 (UTC) Received: by mail-yb1-f179.google.com with SMTP id 131so15812179ybc.7 for ; Thu, 11 Nov 2021 07:09:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=b8o29KaKbhMCf5wOHov2sGbl0/vltBBfTeJdXxiCu74=; b=HsvYfeCVvI5/oZKMA5QfP2HaOAjafm2PgfOucMtpC4Z2WgQ+21r8++32YHxr6ag0th wPchbTINVaBus5keieM66KJC3QJYOvJvQTMkpTHHhiKMTTj80z1O9L15a/NvemKlG1DS fWuFmoBGFfIgnluAzkwl7yYkorvdnfn1OqUJDt6WrFQVsvs9JdtwyZxrSL4+1WEglq3e v/G+dXaJtASdSR0AeJiviYyTzZDzdVtfg5yr/ZWOYt2GBXgmnbj+9F8NM6JpExg6doun otQGxjvR6DBTKL3YXBwS08XmTqQphs6i2nDb9y6j8TSDgA/ms5lPUQRPhE9otePLPqNr 2Biw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b8o29KaKbhMCf5wOHov2sGbl0/vltBBfTeJdXxiCu74=; b=sEVvocR7aYwnI5XyP6pwP5ie5/6N2bg1kq/DGbI+U8EkcSkE3nAin6VsuHhGcIegFO DIiWxUbir2re4PDJawWewLxe6P+Xuwy0N+1f0zq115MWZgXl/Nc7yDpEyjUoHG9qQEXe p1f8Vfvg0q3zAAI06DrgKWIIybp8chZOZ+22SNWe4DcLGf/2z99NMuaqdYsxr0DdHrCb 72j0kuQYLXyPVzQUDML/UkyuCSJxHzA1vlyAYS3BNF/dPpAb/teRErcFkCGtK1DHkb2O 1JZ9Ys5mcDTqDxQgsXHmk81vUyUpVPuxJ/16mRvAEU21ol6KRhRizCwMV4LxAkI5hKT3 LoFQ== X-Gm-Message-State: AOAM532Y5q//HH6/jQOEgpfRvnhdpfGUhrQ2XOWFuxmJjUvXg1FwpYcq qfdYH1rTLXaKC3wD+bBRJRxphvjGrda2Tti/GDMFiCCELR8i7w== X-Google-Smtp-Source: ABdhPJzGfKyTi1LhQjYMtf7XBM9eH87cIhjonTwhq0TRvmNG1Ol//HSSejAJUAlk51wdMnXmMEl65gO+SIhoMGjNCyw= X-Received: by 2002:a05:6902:134b:: with SMTP id g11mr8505610ybu.202.1636642974118; Thu, 11 Nov 2021 07:02:54 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Suren Baghdasaryan Date: Thu, 11 Nov 2021 07:02:42 -0800 Message-ID: Subject: Re: [PATCH 1/1] mm: prevent a race between process_mrelease and exit_mmap To: Michal Hocko 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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: C8CE070009C5 X-Stat-Signature: 5yry68b7iarbns3nxib414b7akcqjs48 Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=HsvYfeCV; spf=pass (imf27.hostedemail.com: domain of surenb@google.com designates 209.85.219.179 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com X-HE-Tag: 1636643354-647171 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 Thu, Nov 11, 2021 at 1:20 AM Michal Hocko wrote: > > On Wed 10-11-21 17:49:37, Suren Baghdasaryan wrote: > > On Tue, Nov 9, 2021 at 1:10 PM Suren Baghdasaryan wrote: > > > > > > On Tue, Nov 9, 2021 at 12:10 PM Michal Hocko wrote: > [...] > > > > Yes, those can run concurrently. One thing I completely forgot about is > > > > 27ae357fa82b ("mm, oom: fix concurrent munlock and oom reaper unmap, v3") > > > > which is about interaction with the munlock. > > > > Agrh! This interaction with the munlock you mentioned requires us to > > take mmap_write_lock before munlock_vma_pages_all and that prevents > > __oom_reap_task_mm from running concurrently with unmap_vmas. The > > reapers would not be as effective as they are now after such a change > > :( > > __oom_reap_task_mm will not run concurrently with unmap_vmas even > with the current code. The mmap_sem barrier right before munlock code > prevents that. You are right, it will run concurrently with another __oom_reap_task_mm in the exit_mmap. But I thought we wanted to get rid of that call to __oom_reap_task_mm in exit_mmap or did I misunderstand? > > -- > Michal Hocko > SUSE Labs