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 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09386C2D0F3 for ; Thu, 2 Apr 2020 13:59:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id B232A20784 for ; Thu, 2 Apr 2020 13:59:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=shutemov-name.20150623.gappssmtp.com header.i=@shutemov-name.20150623.gappssmtp.com header.b="ic81K1Yc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org B232A20784 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=shutemov.name Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 4589F8E0008; Thu, 2 Apr 2020 09:59:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 409988E0007; Thu, 2 Apr 2020 09:59:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 31E2C8E0008; Thu, 2 Apr 2020 09:59:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0029.hostedemail.com [216.40.44.29]) by kanga.kvack.org (Postfix) with ESMTP id 18BF08E0007 for ; Thu, 2 Apr 2020 09:59:26 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id BA57E181AC9BF for ; Thu, 2 Apr 2020 13:59:25 +0000 (UTC) X-FDA: 76663072290.28.fall56_8c798ad2b0757 X-HE-Tag: fall56_8c798ad2b0757 X-Filterd-Recvd-Size: 4432 Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) by imf18.hostedemail.com (Postfix) with ESMTP for ; Thu, 2 Apr 2020 13:59:25 +0000 (UTC) Received: by mail-lf1-f66.google.com with SMTP id d15so1019021lfn.2 for ; Thu, 02 Apr 2020 06:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=JyGaANzpbmOgd9hbQIQ+hfwG/Ln5fgHIKMPhJlc3uAs=; b=ic81K1Yctz8TwEP6tunFK9s9vRLNAoS2KrCGwTSF8ra5lUGaxnmdCiKV2/RzkOZAJo 48/PAZyLBeEjQ6/EKeuypiLNIyzNyzcGD5Ger0/UtxqVp5x5TDsRyUnF7AdzUPANnW4Q 8D0m5+M2Z0NT1LkYBjA/gWrO+6drJ+PjuUhzskLxoZDfDgFjjm1NFlQCXZ8opIB5aBBg dFrMxcq5mJBa8/hL0CIeh/gor/CXvFzZijLa6qqCy2Qw7Hrb9b3Uqk0efBCu3vyda1of X6NpZlmENokblE/SG2sjipnxiB6iOLGVjwgHqvsspqYKtV3NQDVZOp16R3Sj94GBVdTZ 0duA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=JyGaANzpbmOgd9hbQIQ+hfwG/Ln5fgHIKMPhJlc3uAs=; b=grHBD7mVLq5GcHxmvXlhIN0UG9SpXff4NOI92pXYsLNO6yNKB47sfFijqcnBmWZeNH rI/k2mhey0kJBUsTtxXNOYzjqvO5zd9yKMIuo/U8GA4duCXurXJU2unyQ/NXXE9HXn7n vZWFdBqMWvqDV+CgMlccNv3DNBjRkxWdPTOrLypFrmO9je/FLTHhp6yD2w4wxqI7ECUI tZsfUUnI0mOd0OqCqo7Ve8F9Bg//HIrZ0xw1H7AST0fzPx5FpTO+S4DE+ZtqwhkMqMrt y8kTk99uz3RTEAVvpBqXOokWzqHC/aHRWwj2o9UxbfYKh13koyHAXpr5OPISZRtk7mAa 6a5g== X-Gm-Message-State: AGi0Pub9+TuJwyfr5VinFp2INd/ib2+Q3p6KhSbnxwT5GPxikHMnpTU4 v5XWUftoFCTtaiEDV1vPZNOi0A== X-Google-Smtp-Source: APiQypJH6Au9WP/fujbqTpVUaDjKjagTNbD3KN3ucAGjahqnGO1umM0RwX0R5H53sTFhpPYF6H027g== X-Received: by 2002:ac2:42c5:: with SMTP id n5mr2208501lfl.20.1585835963867; Thu, 02 Apr 2020 06:59:23 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id f28sm3937176lfh.10.2020.04.02.06.59.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 06:59:23 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 87AD71020A6; Thu, 2 Apr 2020 16:59:22 +0300 (+03) Date: Thu, 2 Apr 2020 16:59:22 +0300 From: "Kirill A. Shutemov" To: Li Xinhai Cc: linux-mm@kvack.org, akpm@linux-foundation.org, "Kirill A. Shutemov" , Matthew Wilcox , Johannes Weiner Subject: Re: [PATCH 2/3] Revert "mm/rmap.c: reuse mergeable anon_vma as parent when fork" Message-ID: <20200402135922.kcllgas7omuyn5h7@box> References: <1581150928-3214-1-git-send-email-lixinhai.lxh@gmail.com> <1581150928-3214-3-git-send-email-lixinhai.lxh@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1581150928-3214-3-git-send-email-lixinhai.lxh@gmail.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Sat, Feb 08, 2020 at 08:35:27AM +0000, Li Xinhai wrote: > This reverts commit 4e4a9eb921332b9d1edd99f76998f99f36b195f7 > In dup_mmap(), anon_vma_fork() is called for attaching anon_vma and > parameter 'tmp' (i.e., the new vma of child) has same ->vm_next and > ->vm_prev as its parent vma. That causes the anon_vma used by parent been > mistakenly shared by child (In anon_vma_clone(), the code added by that > commit will do this reuse work). > > Besides this issue, the design of reusing anon_vma from vma which has > gone through fork should be avoided ([1]). So, this patch reverts that > commit and maintains the consistent logic of reusing anon_vma for > fork/split/merge vma. > > [1] commit d0e9fe1758f2 ("Simplify and comment on anon_vma re-use for > anon_vma_prepare()") explains the test of "list_is_singular()". I read the description few time, but I cannot say I understood the problem completely. Do you have a test-case to demonstrate the issue? IIUC, re-using anon_vma across fork is wrong, but within the process is fine, right? Maybe we should just check that dst->vm_mm matches src->vm_mm before re-using anon_vma? -- Kirill A. Shutemov