From patchwork Mon Jan 6 06:37:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Xinhai X-Patchwork-Id: 11318741 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 913681398 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 5DCD520848 for ; Mon, 6 Jan 2020 06:39:48 +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 5DCD520848 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) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 896338E0003; Mon, 6 Jan 2020 01:39:47 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org 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-Original-To: linux-mm@kvack.org 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-Spam-Summary: 2,0,0,dff427c23386bca3,d41d8cd98f00b204,lixinhai.lxh@gmail.com,::richardw.yang@linux.intel.com:khlebnikov@yandex-team.ru:kirill.shutemov@linux.intel.com,RULES_HIT:41:355:379:541:800:960:973:988:989:1260:1345:1437:1534:1541:1711:1730:1747:1777:1792:2393:2559:2562:3138:3139:3140:3141:3142:3352:3622:3865:3867:3868:3870:3871:5007:6261:6653:7514:7903:9207:9413:9592:10004:11026:11658:11914:12043:12296:12297:12438:12517:12519:12555:12895:13069:13255:13311:13357:14096:14181:14384:14394:14687:14721:21080:21222:21444:21451:21627:21666:30054:30070,0,RBL:209.85.128.66:@gmail.com:.lbl8.mailshell.net-62.18.0.100 66.100.201.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fp,MSBL:0,DNSBL:neutral,Custom_rules:0:0:0,LFtime:26,LUA_SUMMARY:none 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;