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 3B182C433EF for ; Fri, 12 Nov 2021 16:00:19 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D012D60F5B for ; Fri, 12 Nov 2021 16:00:18 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org D012D60F5B 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 452456B0078; Fri, 12 Nov 2021 11:00:18 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 401AB6B007B; Fri, 12 Nov 2021 11:00:18 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C9746B007D; Fri, 12 Nov 2021 11:00:18 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0142.hostedemail.com [216.40.44.142]) by kanga.kvack.org (Postfix) with ESMTP id 1CA8E6B0078 for ; Fri, 12 Nov 2021 11:00:18 -0500 (EST) Received: from smtpin19.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id CDD7A8249980 for ; Fri, 12 Nov 2021 16:00:17 +0000 (UTC) X-FDA: 78800739906.19.C05B6FD Received: from mail-yb1-f179.google.com (mail-yb1-f179.google.com [209.85.219.179]) by imf19.hostedemail.com (Postfix) with ESMTP id EA962B000187 for ; Fri, 12 Nov 2021 16:00:06 +0000 (UTC) Received: by mail-yb1-f179.google.com with SMTP id s186so24788830yba.12 for ; Fri, 12 Nov 2021 08:00:15 -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=MBw7nAjDOpIx54PL6CtGwWGYEgjR+E9SaAUwBkpc0jU=; b=WSQXrHTUecwEOSkMbrwVBr1/kG09TKAuuO8JuMhKDKK/fO1ZcBuQh+ygHQrscvvgJH tcjgPqYIkW/IqWlXpwfZrQ+F3IylFOhypk/ImwK439XxfSH3ffIWDNiGnxvhXsskudzh KpRPaNZecMQ+yI27VP+/1X0ar1tcVjyz0z8ptzTwAFRoFRNjwI6Gp2c7MQBQBc/GOQ03 NkVdXim3hlPeXY/MOWeWfoez8vYrpjGorH9Ol0mW6lGuDCoOOpttS0lJztrD0ijaTD3d Iyzqhr6Q1SSs13vbRIUsCxyxlRXVobBrLnau+h6RiAC4oveffTcsPOiiuzX0/IEkYdur ygDw== 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=MBw7nAjDOpIx54PL6CtGwWGYEgjR+E9SaAUwBkpc0jU=; b=JiRCouHZCJz+wFAsHPADrxFLwRSH3jCjmP8/kjTlmIsZTH20+5n0/qx3+lcoXMERhA 2Z+4u5wlTwksUKSK4UNJG+WMPrSuOBKJGP74QvzanPePpFNxleSTtP/OLjOFB2gHtc8U TCj7um90agIjfbR5nIwAtH1vVA3B4B71qDprA/0mq1RclhB2yaXeQ2vklUG7mqrloKbo h8xk/NmGkWwn/KkeycaRovHHJ25I3eFH6JQne6A6p4Aw6ipkE/FYvmnbj9TaPViRYsdX +OPSQMv3kYMBADxSTK4hmNxow0S1qsPJDjeAYxPDW/vIrRNQT+iaU6mBGYUfhlbxxRhh qTMg== X-Gm-Message-State: AOAM532S/7l1ZkmmEzpgPxWrPGbTWBUNaxqspQLkBXw3eb/mojoyE10h ve4GL5RpZZhhVo0pVgL3371tnw3sFcj9OroJqYCaIQ== X-Google-Smtp-Source: ABdhPJwHn8mpOswus43mfCk29R4fAdhIqXVj+xv1CqLJYRPCfc06/HRFtJmqn2nab1RhER4AK8hBOKWBSACFO0H4H18= X-Received: by 2002:a05:6902:134b:: with SMTP id g11mr17195784ybu.202.1636732815170; Fri, 12 Nov 2021 08:00:15 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Suren Baghdasaryan Date: Fri, 12 Nov 2021 08:00:04 -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: rspam02 X-Rspamd-Queue-Id: EA962B000187 X-Stat-Signature: yuu8f5jarharu8z9b4hra5gopnw9rwxs Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=WSQXrHTU; spf=pass (imf19.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: 1636732806-625502 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, Nov 12, 2021 at 12:58 AM 'Michal Hocko' via kernel-team wrote: > > On Thu 11-11-21 07:02:42, Suren Baghdasaryan wrote: > > 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? > > I do not remember this to be objective or the motivation. IIRC we wanted > to make the locking more robust which would help your process_mrelease > use case. This one currently suffers from a much heavier cost if it > turns out to be the last holder of the reference count on the address > space. Ok, I wrongly assumed the mmap_lock cleanup should be deeper. Will keep pounding on it. Thanks! > -- > Michal Hocko > SUSE Labs > > -- > To unsubscribe from this group and stop receiving emails from it, send an email to kernel-team+unsubscribe@android.com. >