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=-9.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 94A11C35250 for ; Sat, 8 Feb 2020 08:37:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5E26C21741 for ; Sat, 8 Feb 2020 08:37:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cWjUoJQK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E26C21741 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 5788C6B0008; Sat, 8 Feb 2020 03:37:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4FFD96B000A; Sat, 8 Feb 2020 03:37:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3038B6B000C; Sat, 8 Feb 2020 03:37:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id 193916B0008 for ; Sat, 8 Feb 2020 03:37:40 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 9EC26181AEF00 for ; Sat, 8 Feb 2020 08:37:39 +0000 (UTC) X-FDA: 76466306238.27.price09_89b07d9a1f12 X-HE-Tag: price09_89b07d9a1f12 X-Filterd-Recvd-Size: 4829 Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Sat, 8 Feb 2020 08:37:38 +0000 (UTC) Received: by mail-lj1-f195.google.com with SMTP id x14so1738130ljd.13 for ; Sat, 08 Feb 2020 00:37:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=1DOw5CbbkNYP7FwQdD8qSzaPYEShSYioAUQqNAIQfdY=; b=cWjUoJQKmZ8C3F5DtZz0Rl/lsjnzEGM5g7rKcVy06kF3hSdednyyh59sl/SrJv7RBZ pVAUhkA8AJFeSqBc0a5jWbHq0henpKU9WX29p/IMwTRN/LwLLLCoRIeUV4oRHfss/BZz HYiWQ0UkD7i1vGGgbpWaOTmJ6H5Dxi8vDl3zOMv1QaL17ldW+1etB8cPcPlkq++WiZIU T15O41gcrAShIxVyy9oOaGKMuCJPDnWqOcYuSSx8EnAobZe4WOJWL6o0oW+Vj9L+LStL bipK6SPzoFvdP/ygg3kgo+P4rM0eRPDSDwU4wtqBavmjijqDABjb/+udHcy/NpcwbYjo GZPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=1DOw5CbbkNYP7FwQdD8qSzaPYEShSYioAUQqNAIQfdY=; b=jH8Li90Sna8Z23TBAxJ/GEvWIpCjBjMwbFid3TPBROSkzaGY6QrRl1tQ0c6LuCbjku TvEbubflNExUQWVHLOOU7eexmj1KB+L5CNw7k7GQsno7xhW9nXtDuAl1byxrF+MB//+6 /gfg+GG5GhbWxmmAIBsKu0+O1DlnKRcBpOH6lvmqv4TSUlca0v424fOuMEaZnKbApas4 OkvUtpM6idfoqXiqaW3lQ09lrG4KOYXy2jglxUUiHm1KW+P8fqheUYhbENQPHEMlpXXz Int67nmSsgjOmquLY7H1aa36p8ZOoHhQiQeWl/vBhz8CVPXJIFYg9qOjfcV+Fc7RUtkk FU+A== X-Gm-Message-State: APjAAAVrD+m5qZ8sOTr06KD2G4ED0iCPLIBQmlAj5TWYol3odMW8eZq5 zPMOMqJSrG6J/6M3WhsM+mfv6kBEht8= X-Google-Smtp-Source: APXvYqzwQhZbgdaSQIB6j3niKwDhCjmx+2ZxfM6IA3uZw+QqRwaqq9YsYbv6PD61L7QsopT9Dexgrg== X-Received: by 2002:a2e:884c:: with SMTP id z12mr2162198ljj.55.1581151057670; Sat, 08 Feb 2020 00:37:37 -0800 (PST) Received: from localhost.localdomain.localdomain ([131.228.2.21]) by smtp.gmail.com with ESMTPSA id n11sm2663404ljg.15.2020.02.08.00.37.35 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Feb 2020 00:37:37 -0800 (PST) From: Li Xinhai To: linux-mm@kvack.org Cc: akpm@linux-foundation.org, "Kirill A. Shutemov" , Matthew Wilcox , Johannes Weiner Subject: [PATCH 2/3] Revert "mm/rmap.c: reuse mergeable anon_vma as parent when fork" Date: Sat, 8 Feb 2020 08:35:27 +0000 Message-Id: <1581150928-3214-3-git-send-email-lixinhai.lxh@gmail.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1581150928-3214-1-git-send-email-lixinhai.lxh@gmail.com> References: <1581150928-3214-1-git-send-email-lixinhai.lxh@gmail.com> 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: 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()". Fixes: 4e4a9eb92133 ("mm/rmap.c: reuse mergeable anon_vma as parent when fork") Signed-off-by: Li Xinhai Cc: Kirill A. Shutemov Cc: Matthew Wilcox Cc: Johannes Weiner --- mm/rmap.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index b3e3819..861435b 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -269,19 +269,6 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src) { struct anon_vma_chain *avc, *pavc; struct anon_vma *root = NULL; - struct vm_area_struct *prev = dst->vm_prev, *pprev = src->vm_prev; - - /* - * If parent share anon_vma with its vm_prev, keep this sharing in in - * child. - * - * 1. Parent has vm_prev, which implies we have vm_prev. - * 2. Parent and its vm_prev have the same anon_vma. - */ - if (!dst->anon_vma && src->anon_vma && - pprev && pprev->anon_vma == src->anon_vma) - dst->anon_vma = prev->anon_vma; - list_for_each_entry_reverse(pavc, &src->anon_vma_chain, same_vma) { struct anon_vma *anon_vma; -- 1.8.3.1