Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1540538pxk; Sun, 13 Sep 2020 06:40:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiMPUQPVAO/ZqO97jvn2CL9+f97tLDogbeZ7Vv7+Zo0Rz14G5L6Pe2lOBX2OcDTw2ED574 X-Received: by 2002:a17:906:cf82:: with SMTP id um2mr10183792ejb.49.1600004404124; Sun, 13 Sep 2020 06:40:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600004404; cv=none; d=google.com; s=arc-20160816; b=x+GQxXki7mwX1BbV2WMQMWYnTWYZ7j4uUGuc64aRpLTiokbY5kVNyi1dDYppSKGuIJ QVRd5W9NRL+lmpJh2Tli/O+PElP37oNE8X+QvfshTmQLF3WXYJ40vzIxjJ9Bl1yQ1OqL waymnXbKNcJB+oGRH1tyjKwo/Zv0RpT2iWV6rE4jVFGkSsuLHGWzh8DOwFVLkCWcwjXa id5X6kyAJOFy9fLUKEbowfCNqPUHbtHS9KksiZpZMCP2s8lx99eObkzmjPxyGLeUbWls MVVVrlQGH+kur+MdaM+/n+B2OAn9sSrgzVKZoLVtCWCKBIh/4J2OmtkHvlr1rlQtjHfE x4eA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=ZsBbZwvBEVLjORX1fkXcP3lk0u21MUn1glNJ/Be5Tzg=; b=FdOWWQHGF2LOKHDt8nSmY8NISlaxOcybV2o3+6S+etpVn4w5st7PnxK5/NSiWsvt2z Zfw3vcBU4QqZxHiF7lQFGYGzvRkizwkFHxqHI6INrsxWVHhlq2FR2/itFabfKYDWQHZo qRpGB0xnQlDGJK8diBHWRVhc6poW9fwTjH1wHCYGDpaRlLTXG9rob3J6sysHDBOZ4ZQ/ tQeGe21lUIGbJMUKUHou1KY5Y3IoO2Mcxm2nWe5bOCYdn7bvn1i1mS5Wnvt6DAtry5xH dLGDsWgW+oyzHQoIBWVgIPe9LB+MWHkEgGTiEybjwTl5d1rEPMt3Eh1ErE5/e30fzq4i Izqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v8si5777633edb.255.2020.09.13.06.39.41; Sun, 13 Sep 2020 06:40:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725957AbgIMNhd (ORCPT + 99 others); Sun, 13 Sep 2020 09:37:33 -0400 Received: from out30-132.freemail.mail.aliyun.com ([115.124.30.132]:53648 "EHLO out30-132.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725933AbgIMNgk (ORCPT ); Sun, 13 Sep 2020 09:36:40 -0400 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R141e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04395;MF=richard.weiyang@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0U8mqL2S_1600004197; Received: from localhost(mailfrom:richard.weiyang@linux.alibaba.com fp:SMTPD_---0U8mqL2S_1600004197) by smtp.aliyun-inc.com(127.0.0.1); Sun, 13 Sep 2020 21:36:37 +0800 From: Wei Yang To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Wei Yang Subject: [PATCH 2/2] mm/mmap: check on file instead of the rb_root_cached of its address_space Date: Sun, 13 Sep 2020 21:36:31 +0800 Message-Id: <20200913133631.37781-2-richard.weiyang@linux.alibaba.com> X-Mailer: git-send-email 2.20.1 (Apple Git-117) In-Reply-To: <20200913133631.37781-1-richard.weiyang@linux.alibaba.com> References: <20200913133631.37781-1-richard.weiyang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In __vma_adjust(), we do the check on *root* to decide whether to adjust the address_space. While it seems to be more meaningful to do the check on *file* itself. This means we are adjust some data because it is a file backed vma. Since we seems to assume the address_space is valid if it is a file backed vma, let's just replace *root* with *file* here. Signed-off-by: Wei Yang --- mm/mmap.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/mmap.c b/mm/mmap.c index 30b155098606..829897646a9c 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -823,7 +823,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start, anon_vma_interval_tree_pre_update_vma(next); } - if (root) { + if (file) { flush_dcache_mmap_lock(mapping); vma_interval_tree_remove(vma, root); if (adjust_next) @@ -844,7 +844,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start, next->vm_pgoff += adjust_next >> PAGE_SHIFT; } - if (root) { + if (file) { if (adjust_next) vma_interval_tree_insert(next, root); vma_interval_tree_insert(vma, root); @@ -896,7 +896,7 @@ int __vma_adjust(struct vm_area_struct *vma, unsigned long start, anon_vma_unlock_write(anon_vma); } - if (root) { + if (file) { i_mmap_unlock_write(mapping); uprobe_mmap(vma); -- 2.20.1 (Apple Git-117)