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 94F6FC433FE for ; Tue, 2 Nov 2021 15:14:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7D9F860F5A for ; Tue, 2 Nov 2021 15:14:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234282AbhKBPRd (ORCPT ); Tue, 2 Nov 2021 11:17:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234268AbhKBPRa (ORCPT ); Tue, 2 Nov 2021 11:17:30 -0400 Received: from mail-yb1-xb32.google.com (mail-yb1-xb32.google.com [IPv6:2607:f8b0:4864:20::b32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D2B03C0613B9 for ; Tue, 2 Nov 2021 08:14:55 -0700 (PDT) Received: by mail-yb1-xb32.google.com with SMTP id d10so43039131ybe.3 for ; Tue, 02 Nov 2021 08:14:55 -0700 (PDT) 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=m4vo3xOow7zioCDniOqo/cUmPTsQ9k5oLRBoc2H5RmM=; b=LjddqU8TuEc2mSGQVv8Shw6Rr8F04MBGWv+W9yGEUEesBAdukLgf4ydPLMDaao9Wdw 9WLQvTXkckHoyRv6v9GtcQoSUqzNA61qJKqXNqcM6Dnek77lhQqK/epy8W9dn2XJTY0D 5Hu193h2Bd0tO0VjKZX99CKIYedxlVnhR4JCkYCE/HxlIFSA2W+wXQ+pVuYUCi2eI8Dz Wfc8Fj+9itDanLTLbQ94LQqSz2tUOXmnTPsWjOsTR54diV0sM/fHxQ2UILjdC/hLJtJL Mg/UJHcPBF/D9ZufOMQ2XQlFAzttQ/jqQSJ9gzipUDab72pOLdanRYCcxzwlhw7og6jV awxg== 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=m4vo3xOow7zioCDniOqo/cUmPTsQ9k5oLRBoc2H5RmM=; b=i1cN3rbnMZos7a/gMuJXh3djkDEpa/xbdypJWVRd5fwsxn7aoxE3MpodeloNAQVN20 McdDgQ5AShjyJ4ZGR2AMTAlYjO9JNvRyZuXHC2YObATm9Q2wo5nmqs/cKCEJsU7MWU0N wfbO8emcpLk8sHPEq9CzhITfoQK/1xebLbV3FE40nfsamd25cz6UYEQL1qrFJP5opxA5 o/ri57u5bLNaeN71wjI1QNjRHP0KhTKxbvb31w6qS48XTW1hfQXYCKKh4bBTsv3jrYkz TxEk8gckd6z7CsZr4ZPV9UUs7XDm/8CdVj3D607sNhqDb5SHXz418G8/zFncAXJ7ZOIs 1vcw== X-Gm-Message-State: AOAM532p8s0FmxjcWswGTegZ01faZDxCJVbnqxspWGZTrk2yp/n6sSpF I/6y7BqSZRlmvMKzdZTSjJjzispUtAZWI9V9ZGskng== X-Google-Smtp-Source: ABdhPJzVNIQAwK+DaQmN14pKDqKRyuYzpi/QTvph4WYwByoDr2ZVNR43H0trqcjKVtUtTg2UFfwMO19+eG3dj3An+7g= X-Received: by 2002:a25:2f58:: with SMTP id v85mr33607068ybv.487.1635866094771; Tue, 02 Nov 2021 08:14:54 -0700 (PDT) MIME-Version: 1.0 References: <20211022014658.263508-1-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Tue, 2 Nov 2021 08:14:43 -0700 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" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Nov 2, 2021 at 12:58 AM Michal Hocko wrote: > > On Mon 01-11-21 08:44:58, Suren Baghdasaryan wrote: > [...] > > I'm with you on this one, that's why I wanted to measure the price we > > would pay. Below are the test results: > > > > Test: https://lore.kernel.org/all/20170725142626.GJ26723@dhcp22.suse.cz/ > > Compiled: gcc -O2 -static test.c -o test > > Test machine: 128 core / 256 thread 2x AMD EPYC 7B12 64-Core Processor > > (family 17h) > > > > baseline (Linus master, f31531e55495ca3746fb895ffdf73586be8259fa) > > p50 (median) 87412 > > p95 168210 > > p99 190058 > > average 97843.8 > > stdev 29.85% > > > > unconditional mmap_write_lock in exit_mmap (last column is the change > > from the baseline) > > p50 (median) 88312 +1.03% > > p95 170797 +1.54% > > p99 191813 +0.92% > > average 97659.5 -0.19% > > stdev 32.41% > > > > unconditional mmap_write_lock in exit_mmap + Matthew's patch (last > > column is the change from the baseline) > > p50 (median) 88807 +1.60% > > p95 167783 -0.25% > > p99 187853 -1.16% > > average 97491.4 -0.36% > > stdev 30.61% > > > > stdev is quite high in all cases, so the test is very noisy. > > The impact seems quite low IMHO. WDYT? > > Results being very noisy is what I recall as well. Thanks! I believe, despite the noise, the percentiles show that overall we do not noticeably regress the exit path by taking mmap_lock unconditionally. If there are no objections, I would like to post a patchset which implements unconditional locking in exit_mmap() and process_madvise() calling __oom_reap_task_mm() under protection of read mmap_lock. Thanks! > -- > Michal Hocko > SUSE Labs