From patchwork Mon Jan 6 06:32:31 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Li Xinhai X-Patchwork-Id: 11318731 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 929CE1398 for ; Mon, 6 Jan 2020 06:34:20 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5C5D1218AC for ; Mon, 6 Jan 2020 06:34:20 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HCKdKG8c" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C5D1218AC 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 9ADE48E0005; Mon, 6 Jan 2020 01:34:19 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 95DF58E0003; Mon, 6 Jan 2020 01:34:19 -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 84C148E0005; Mon, 6 Jan 2020 01:34:19 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0037.hostedemail.com [216.40.44.37]) by kanga.kvack.org (Postfix) with ESMTP id 7307B8E0003 for ; Mon, 6 Jan 2020 01:34:19 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with SMTP id 321EA180AD801 for ; Mon, 6 Jan 2020 06:34:19 +0000 (UTC) X-FDA: 76346245038.25.nerve84_42c4ff9c04d1d X-Spam-Summary: 2,0,0,ed28d8a0961033fb,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:3870:3876:5007:6261:6653:7514:7901: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:21212:21222:21444:21451:21627:21666:30054:30070,0,RBL:209.85.167.68:@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:25,LUA_SUMMARY:none X-HE-Tag: nerve84_42c4ff9c04d1d X-Filterd-Recvd-Size: 4235 Received: from mail-lf1-f68.google.com (mail-lf1-f68.google.com [209.85.167.68]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Mon, 6 Jan 2020 06:34:18 +0000 (UTC) Received: by mail-lf1-f68.google.com with SMTP id n12so35665252lfe.3 for ; Sun, 05 Jan 2020 22:34:18 -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=5AJz2byv6kldyDLka3OK/FVAnZaUSlGjLc7wtl3fdDM=; b=HCKdKG8c/9Y6QhrthSt7QDOXVQ1klM2Zvy3p2IKyFRAXCg/h+fjGR5jtdrJuYlP6Dn n6aJfvyA1anZ0a/beird0vxNjvtZGPstJNH1mY9h83z+9EXc6S3ugEhHPe59d9bF6fZJ YVAu4CGRm95/NCK/z372ev67cIjMl7rgJnP7htXrNxVZMaS9Xbf0kGNMh2O/owXpvGur 3C8ro54WX8Tom2twTzBGpOm+UtctYfI8QFgOeCP8+Z1vspVu8rHsKK9TBFfemWy7e8wK iR8CYtr9Onj78xJXe+6pXRovr6HECAgE7OJmmnG7CXLpnammphh9k3+EQPOIFEA3p53x nsuw== 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=5AJz2byv6kldyDLka3OK/FVAnZaUSlGjLc7wtl3fdDM=; b=BDdlBfqw4Eq/K6zWLn/S0vCsrDOdRLpKNxnw0Zf7hwV0D76ah9zWFeETJJj12Ixq0+ NJASYa4VHLqPNPccZqcrqmXfuCDRXCO0rtFeMfCMGKTCObDbCblZX+SftEJFPC4qRLOp RRAUVUScrkJD4tOzSivZd0XVXo0BzHYR/Z+759+gOjcZ/M1aWYifI3ztHULtpDlKC0bY EZafkIFHEMkspPzP4bFbfqw/+ZkUYu8o/YqdggL3jjhtoqIHxuxig9Fg8eT+74wcyFSb eVizyIQnbn0kgm71+s5yY90kokNWDyStMe1DH2hxSFwFRct4nV1SPrlaKKfd1U9ap/gW qNmg== X-Gm-Message-State: APjAAAXDYt3raOyaDmn8HzUTgGANrC4JkWdzX3gKrx0WMdtuXuxkpb0O o1mhTppM+lJHaEhqSuvNIdc4OUtN X-Google-Smtp-Source: APXvYqwp4XmOI0/nYsvfLsiCIL6EqIqVQWIs/jZHZ3Dbz1+ZbvK7bFO8tfH72xkodsrT0mh/8IxEkw== X-Received: by 2002:ac2:5337:: with SMTP id f23mr54643921lfh.192.1578292456823; Sun, 05 Jan 2020 22:34:16 -0800 (PST) Received: from localhost.localdomain.localdomain ([131.228.2.21]) by smtp.gmail.com with ESMTPSA id g24sm28553711lfb.85.2020.01.05.22.34.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 05 Jan 2020 22:34:16 -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 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. Date: Mon, 6 Jan 2020 06:32:31 +0000 Message-Id: <1578292351-2501-1-git-send-email-lixinhai.lxh@gmail.com> X-Mailer: git-send-email 1.8.3.1 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000042, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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;