Received: by 10.192.165.156 with SMTP id m28csp709192imm; Fri, 13 Apr 2018 06:34:35 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+Otkqzbyji1lF6aK5PXAOVKg0s4rdjdEP+iZgIxWFrOm3To/C2LBCw6JdLrWZ87qlqh6k4 X-Received: by 2002:a17:902:24c:: with SMTP id 70-v6mr5271843plc.384.1523626475784; Fri, 13 Apr 2018 06:34:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523626475; cv=none; d=google.com; s=arc-20160816; b=ZcpH5xEzhbePVWyvMKJdfATxpcfKUUGFCqxJd2K/LrH9pO1ENAw7mUs0RFVrtLF6WC Btuh0bHniZN2NBywmsPJdkmecf1ZnD1nu1H9jbeP7TH2hIo1HbKg6KeZR+NYwi9pAIAM NRnvGtICoPFwsd3aHZ1pj2nFHcCOXRyXCPN8Cp2pPkCVKNT3vTRyve/R3mGQUR4nrNYh UKb+1r/YSXzTYfvUC7661089QqNVt28kTHgCJZae9MIGHR7JbF7FgEgu6EWtSKIVJWtx w/uflCGfS2SqhqAPafGf+n9ktB4npDZIWhpWQ9JP4t5GYWxJo5ULVcqnHf5XsOR2HN2Y RDnA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=LgGRG1YOqi3fU7UJSKPgmhgkYeI18+AHMp4HMoFNRIQ=; b=ZejyGTy9CzL7lG3KcKo6CMFDmNaL+L7jyQFQG7vXFoo/Nl/ZL9lxJzP288RskZMOzU KPpxwsSN5maWEqQBYEPE7QiM0NOQL8wDio3iOfAwZmwpK/OCnIokTRi7iX0u6UZ861RJ SfQL61R+IQS1D5YXyxWm1IDMv51wodJN7NOq/y0eiWroLT2MC16+CN1wNZQaQS2Ue6M6 lkDPgY41cQfzOe6rMOKiCYa4C+JkJug7PiO1RKxiz21tnIMnJhKft4hNSdAPE7H1Qb83 LFnVW5R2SATZ/LT8EZ2zU6dDwBU0u/tM2E4SCIVTFFGth3uDBoXYAaMQaZ9V0wXxbJcx KNYw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j4si3994348pgq.54.2018.04.13.06.34.21; Fri, 13 Apr 2018 06:34:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754539AbeDMLli (ORCPT + 99 others); Fri, 13 Apr 2018 07:41:38 -0400 Received: from mx2.suse.de ([195.135.220.15]:40396 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753114AbeDMLlh (ORCPT ); Fri, 13 Apr 2018 07:41:37 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id E8A27ACA8; Fri, 13 Apr 2018 11:41:35 +0000 (UTC) Date: Fri, 13 Apr 2018 13:41:33 +0200 From: Michal Hocko To: Chintan Pandya Cc: Anshuman Khandual , vbabka@suse.cz, labbott@redhat.com, catalin.marinas@arm.com, hannes@cmpxchg.org, f.fainelli@gmail.com, xieyisheng1@huawei.com, ard.biesheuvel@linaro.org, richard.weiyang@gmail.com, byungchul.park@lge.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: vmalloc: Remove double execution of vunmap_page_range Message-ID: <20180413114133.GJ17484@dhcp22.suse.cz> References: <1523611019-17679-1-git-send-email-cpandya@codeaurora.org> <8da9f826-2a3d-e618-e512-4fc8d45c16f2@codeaurora.org> <20180413110949.GA17670@dhcp22.suse.cz> <696fedc5-6bcd-f0a0-62f5-4f9e7b7c602a@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <696fedc5-6bcd-f0a0-62f5-4f9e7b7c602a@codeaurora.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri 13-04-18 16:57:06, Chintan Pandya wrote: > > > On 4/13/2018 4:39 PM, Michal Hocko wrote: > > On Fri 13-04-18 16:15:26, Chintan Pandya wrote: > > > > > > > > > On 4/13/2018 4:10 PM, Anshuman Khandual wrote: > > > > On 04/13/2018 03:47 PM, Chintan Pandya wrote: > > > > > > > > > > > > > > > On 4/13/2018 3:29 PM, Anshuman Khandual wrote: > > > > > > On 04/13/2018 02:46 PM, Chintan Pandya wrote: > > > > > > > Unmap legs do call vunmap_page_range() irrespective of > > > > > > > debug_pagealloc_enabled() is enabled or not. So, remove > > > > > > > redundant check and optional vunmap_page_range() routines. > > > > > > > > > > > > vunmap_page_range() tears down the page table entries and does > > > > > > not really flush related TLB entries normally unless page alloc > > > > > > debug is enabled where it wants to make sure no stale mapping is > > > > > > still around for debug purpose. Deferring TLB flush improves > > > > > > performance. This patch will force TLB flush during each page > > > > > > table tear down and hence not desirable. > > > > > > > > > > > Deferred TLB invalidation will surely improve performance. But force > > > > > flush can help in detecting invalid access right then and there. I > > > > > > > > Deferred TLB invalidation was a choice made some time ago with the > > > > commit db64fe02258f1507e ("mm: rewrite vmap layer") as these vmalloc > > > > mappings wont be used other than inside the kernel and TLB gets > > > > flushed when they are reused. This way it can still avail the benefit > > > > of deferred TLB flushing without exposing itself to invalid accesses. > > > > > > > > > chose later. May be I should have clean up the vmap tear down code > > > > > as well where it actually does the TLB invalidation. > > > > > > > > > > Or make TLB invalidation in free_unmap_vmap_area() be dependent upon > > > > > debug_pagealloc_enabled(). > > > > > > > > Immediate TLB invalidation needs to be dependent on debug_pagealloc_ > > > > enabled() and should be done only for debug purpose. Contrary to that > > > > is not desirable. > > > > > > > Okay. I will raise v2 for that. > > > > More importantly. Your changelog absolutely lacks the _why_ part. It > > just states what the code does which is not all that hard to read from > > the diff. It is usually much more important to present _why_ the patch > > is an improvement and worth merging. > > > > It is improving performance in debug scenario. Do not forget to add some numbers presenting the benefits when resubmitting. > More than that, I see it > as a clean up. Sure, I will try to address *why* in next change log. As Anshuman pointed out the current code layout is deliberate. If you believe that reasons mentioned previously are not valid then dispute them and provide your arguments in the changelog. -- Michal Hocko SUSE Labs