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,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 53DADC33C9A for ; Mon, 6 Jan 2020 06:39:48 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 128B920848 for ; Mon, 6 Jan 2020 06:39:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="pkhS2EgN" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 128B920848 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 8E59C8E0005; Mon, 6 Jan 2020 01:39:47 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 896338E0003; Mon, 6 Jan 2020 01:39:47 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 7AC4B8E0005; Mon, 6 Jan 2020 01:39:47 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0047.hostedemail.com [216.40.44.47]) by kanga.kvack.org (Postfix) with ESMTP id 630A48E0003 for ; Mon, 6 Jan 2020 01:39:47 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 22D2333C4 for ; Mon, 6 Jan 2020 06:39:47 +0000 (UTC) X-FDA: 76346258814.25.tooth29_727f427875735 X-HE-Tag: tooth29_727f427875735 X-Filterd-Recvd-Size: 4240 Received: from mail-wm1-f66.google.com (mail-wm1-f66.google.com [209.85.128.66]) by imf39.hostedemail.com (Postfix) with ESMTP for ; Mon, 6 Jan 2020 06:39:46 +0000 (UTC) Received: by mail-wm1-f66.google.com with SMTP id a5so13928456wmb.0 for ; Sun, 05 Jan 2020 22:39:46 -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; bh=kiOhNTJkhfDqOboVhcDkiKbS+SGjJD4wBnjXhIbD4vY=; b=pkhS2EgNCfmWEICOv7Dwg56USWUOOIHSvaj7FmPWnJO8HGO0Yma9sm6kEvwa/rjutn 7Hm6wdnEH+9/mtspBCzHN8v+T2tsH5zs/Aw8djGNGpp+Vg0UIWN+gzoxbbfGY5w9rgFG HqQZp0u2qB42fsNTlKG3SiQN15sPkD6uU57j+gM5Ezd/XW7YgHN+jhqUXPE5ppIofRCf GGin9WXV+gSSBfD2zg4LqsESu0/mX94+hW5RLq0ybk3u7+k7No37I0hiNIJHGZQxvWF+ sighy1dE+JQdS05IHiH7N5l3U5v8cU2LZvm02Sop4uxysFHh3zMsyaehS7MoU227g/Qj EHmg== 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; bh=kiOhNTJkhfDqOboVhcDkiKbS+SGjJD4wBnjXhIbD4vY=; b=AopUzZUS0FXhfysmULWbb36EehgvP7xN16V4KlT9EbkmfLoq3NIeRXX6FzzDWbcRdi jjzpNwup5Ud6gg7C83vUhlIFwz3ZlzAJ8acD2dm+qk5OUxBOmr6/DQ4TwafPE7sXwNkS nUg0L9U0666TIKBLQ7BDjDrgpns+2idbLo8e0aei+4XDSvf/ALwV/8PgpkI4i1fnDN/B lbLeiWpbZtR43FLo3hRigEZ80MtzYXOh/fHLnOtq2aswVBwAys2RlMPlPHeH63dm0bxi USJ72nd/J5ECLhEv1agVTzOc9ovCQdPdPO+7ZLXDg3qPaeeRxHxwZ1n9OMeT9FgKjYr4 VNsw== X-Gm-Message-State: APjAAAUd86WriN3cvNFVjYp6fj98wTGoZtLfmv3DowceVwUxN1M5hOdw insvAsmCv1kZgWMqIjytXCFPJ09N X-Google-Smtp-Source: APXvYqyX3SHJsBWIxQeUIKOGoL0TbLXGEPnn3MnBnbidTYYJlOKOP+fBV6GIp//XB/UDv3KYGSo/ZQ== X-Received: by 2002:a1c:b7c4:: with SMTP id h187mr32836870wmf.105.1578292785235; Sun, 05 Jan 2020 22:39:45 -0800 (PST) Received: from localhost.localdomain.localdomain ([131.228.2.21]) by smtp.gmail.com with ESMTPSA id u8sm21787782wmm.15.2020.01.05.22.39.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jan 2020 22:39:44 -0800 (PST) From: Li Xinhai To: linux-mm@kvack.org Cc: Wei Yang , Konstantin Khlebnikov , "Kirill A. Shutemov" Subject: [PATCH] mm/rmap.c: remove useless checking to child vma->vm_prev in anon_vma_clone Date: Mon, 6 Jan 2020 06:37:59 +0000 Message-Id: <1578292679-2592-1-git-send-email-lixinhai.lxh@gmail.com> X-Mailer: git-send-email 1.8.3.1 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: For fork case, the dst->vm_prev is always same as src->vm_prev when anon_vma_clone() is called. Removing the assignment from dst->vm_prev->anon_vma to dst->anon_vma, and explictly assign from anon_vma which is shared by its parent vmas. Signed-off-by: Li Xinhai Cc: Wei Yang Cc: Konstantin Khlebnikov Cc: Kirill A. Shutemov --- mm/rmap.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mm/rmap.c b/mm/rmap.c index b3e3819..3c912a6c 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -269,10 +269,10 @@ 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; + struct vm_area_struct *pprev = src->vm_prev; /* - * If parent share anon_vma with its vm_prev, keep this sharing in in + * If parent share anon_vma with its vm_prev, keep this sharing in * child. * * 1. Parent has vm_prev, which implies we have vm_prev. @@ -280,8 +280,7 @@ int anon_vma_clone(struct vm_area_struct *dst, struct vm_area_struct *src) */ if (!dst->anon_vma && src->anon_vma && pprev && pprev->anon_vma == src->anon_vma) - dst->anon_vma = prev->anon_vma; - + dst->anon_vma = pprev->anon_vma; list_for_each_entry_reverse(pavc, &src->anon_vma_chain, same_vma) { struct anon_vma *anon_vma; -- 1.8.3.1