From patchwork Thu Sep 29 08:18:18 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9355901 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1B8E7600C8 for ; Thu, 29 Sep 2016 08:37:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C9B62990C for ; Thu, 29 Sep 2016 08:37:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 013832990F; Thu, 29 Sep 2016 08:37:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 302642990C for ; Thu, 29 Sep 2016 08:37:26 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bpWp8-0004ty-J6; Thu, 29 Sep 2016 08:36:10 +0000 Received: from mail.fireflyinternet.com ([109.228.58.192] helo=fireflyinternet.com) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bpWp2-0004jZ-JE for linux-arm-kernel@lists.infradead.org; Thu, 29 Sep 2016 08:36:06 +0000 X-Default-Received-SPF: pass (skip=forwardok (res=PASS)) x-ip-name=78.156.65.138; Received: from nuc-i3427.alporthouse.com (unverified [78.156.65.138]) by fireflyinternet.com (Firefly Internet (M1)) with ESMTP id 2435212-1500050 for multiple; Thu, 29 Sep 2016 09:18:19 +0100 Received: by nuc-i3427.alporthouse.com (sSMTP sendmail emulation); Thu, 29 Sep 2016 09:18:18 +0100 Date: Thu, 29 Sep 2016 09:18:18 +0100 From: Chris Wilson To: Jisheng Zhang Subject: Re: [PATCH] mm/vmalloc: reduce the number of lazy_max_pages to reduce latency Message-ID: <20160929081818.GE28107@nuc-i3427.alporthouse.com> References: <20160929073411.3154-1-jszhang@marvell.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20160929073411.3154-1-jszhang@marvell.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160929_013605_016135_60BDAA6D X-CRM114-Status: GOOD ( 15.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: npiggin@kernel.dk, linux-kernel@vger.kernel.org, linux-mm@kvack.org, agnel.joel@gmail.com, rientjes@google.com, akpm@linux-foundation.org, mgorman@techsingularity.net, iamjoonsoo.kim@lge.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP On Thu, Sep 29, 2016 at 03:34:11PM +0800, Jisheng Zhang wrote: > On Marvell berlin arm64 platforms, I see the preemptoff tracer report > a max 26543 us latency at __purge_vmap_area_lazy, this latency is an > awfully bad for STB. And the ftrace log also shows __free_vmap_area > contributes most latency now. I noticed that Joel mentioned the same > issue[1] on x86 platform and gave two solutions, but it seems no patch > is sent out for this purpose. > > This patch adopts Joel's first solution, but I use 16MB per core > rather than 8MB per core for the number of lazy_max_pages. After this > patch, the preemptoff tracer reports a max 6455us latency, reduced to > 1/4 of original result. My understanding is that should now be safe. That should significantly reduce the preempt-disabled section, I think. -Chris diff --git a/mm/vmalloc.c b/mm/vmalloc.c index 91f44e78c516..3f7c6d6969ac 100644 --- a/mm/vmalloc.c +++ b/mm/vmalloc.c @@ -626,7 +626,6 @@ void set_iounmap_nonlazy(void) static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end, int sync, int force_flush) { - static DEFINE_SPINLOCK(purge_lock); struct llist_node *valist; struct vmap_area *va; struct vmap_area *n_va; @@ -637,12 +636,6 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end, * should not expect such behaviour. This just simplifies locking for * the case that isn't actually used at the moment anyway. */ - if (!sync && !force_flush) { - if (!spin_trylock(&purge_lock)) - return; - } else - spin_lock(&purge_lock); - if (sync) purge_fragmented_blocks_allcpus(); @@ -667,7 +660,6 @@ static void __purge_vmap_area_lazy(unsigned long *start, unsigned long *end, __free_vmap_area(va); spin_unlock(&vmap_area_lock); } - spin_unlock(&purge_lock); } /*