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=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 800B1C4360C for ; Fri, 4 Oct 2019 22:38:46 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 4C7FF20873 for ; Fri, 4 Oct 2019 22:38:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 4C7FF20873 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E9E5C6B0003; Fri, 4 Oct 2019 18:38:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E4F456B0005; Fri, 4 Oct 2019 18:38:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D3C706B0006; Fri, 4 Oct 2019 18:38:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0052.hostedemail.com [216.40.44.52]) by kanga.kvack.org (Postfix) with ESMTP id ABD8D6B0003 for ; Fri, 4 Oct 2019 18:38:45 -0400 (EDT) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with SMTP id 4E6738418 for ; Fri, 4 Oct 2019 22:38:45 +0000 (UTC) X-FDA: 76007568210.29.ball35_697969117d216 X-HE-Tag: ball35_697969117d216 X-Filterd-Recvd-Size: 2877 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by imf25.hostedemail.com (Postfix) with ESMTP for ; Fri, 4 Oct 2019 22:38:44 +0000 (UTC) X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Oct 2019 15:38:42 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,257,1566889200"; d="scan'208";a="186395689" Received: from richard.sh.intel.com (HELO localhost) ([10.239.159.54]) by orsmga008.jf.intel.com with ESMTP; 04 Oct 2019 15:38:40 -0700 Date: Sat, 5 Oct 2019 06:38:22 +0800 From: Wei Yang To: Konstantin Khlebnikov Cc: Wei Yang , akpm@linux-foundation.org, kirill.shutemov@linux.intel.com, jglisse@redhat.com, mike.kravetz@oracle.com, riel@surriel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm/rmap.c: reuse mergeable anon_vma as parent when fork Message-ID: <20191004223822.GB32588@richard> Reply-To: Wei Yang References: <20191004160632.30251-1-richardw.yang@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) 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: On Fri, Oct 04, 2019 at 07:33:53PM +0300, Konstantin Khlebnikov wrote: >On 04/10/2019 19.06, Wei Yang wrote: >> In function __anon_vma_prepare(), we will try to find anon_vma if it is >> possible to reuse it. While on fork, the logic is different. >> >> Since commit 5beb49305251 ("mm: change anon_vma linking to fix >> multi-process server scalability issue"), function anon_vma_clone() >> tries to allocate new anon_vma for child process. But the logic here >> will allocate a new anon_vma for each vma, even in parent this vma >> is mergeable and share the same anon_vma with its sibling. This may do >> better for scalability issue, while it is not necessary to do so >> especially after interval tree is used. >> >> Commit 7a3ef208e662 ("mm: prevent endless growth of anon_vma hierarchy") >> tries to reuse some anon_vma by counting child anon_vma and attached >> vmas. While for those mergeable anon_vmas, we can just reuse it and not >> necessary to go through the logic. >> >> After this change, kernel build test reduces 20% anon_vma allocation. >> > >Makes sense. This might have much bigger effect for scenarios when task >unmaps holes in huge vma as red-zones between allocations and then forks. > >Acked-by: Konstantin Khlebnikov > Thanks -- Wei Yang Help you, Help me