Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp700948imm; Wed, 19 Sep 2018 05:40:20 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZoDh2pY8k6sX3uV1zNdOTBFQIXKDgb9lCinuALglR5M0fvJBHMLA4SKaDysQq1dDht74e/ X-Received: by 2002:a17:902:7606:: with SMTP id k6-v6mr33877566pll.300.1537360820539; Wed, 19 Sep 2018 05:40:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537360820; cv=none; d=google.com; s=arc-20160816; b=uFtVIx2YxCay7Ka1+JWRNyulBxYMIBFbk48a9JCBsNaFExm3+2qv/Nw2fRdlTzFvL5 0K/vSdf6CbwWuW3MgczPu9fFaGydGPBNcZMeYE3depCZQCTE9wGUZ4L2dgOaUxecSWFJ DDYNu/klNPc1nFYkgDICOIFYTT3WbHJMuOOI1TBt0TGT2cOxjHtaop2/wtEaNQZ3HKUK EJhcBO2mrDQzg42ivH8CnSSIB7jLs+yWvIeZhbmrF38qlDIKvfYWx+YhlUImIfs0iFZo 73s1eTWSFjFtMHjA+Sk3VhVobmgFXejpO6bK5zqYNGT2qwPFXku7Qc+n4eW+2kw6uzN2 UvrQ== 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:dkim-signature; bh=gdmlnihdyKW+x3QbLohzUu8kKtbNWAYX/WDsFSCvjvA=; b=BobvlVKbMvZpOjfHOQi8I27dm832siXAzEWTJSjUEAl1/ZVaKt5Oi9FlpQTWngckoX ZtlWir5ejBR/1moByFWEcqcJn0py2v6dQWIxfbzXB+5WleapUU6GTAScDihTWuT+Ty5Q 6Kw5zhZK8vECbLBWO4/+yJp9T4tBh1sbU8JSZ6kFgGTmb4yNgq4quShdgju1Q/xnVK96 CUZP5ckrz+if7UP9bya1+CVkyRoWsVsJk4AlPprDRW7pYNWSsOqbWY3NE80xLIiNRtTE vOntEBGklAv46c6kxkQydhSiDfbiWxYoxlO1sysNX77xVcj0jtHIEoRGPmsqm33puyl8 LFtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=m2vIcWje; 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 z63-v6si21150497pfi.214.2018.09.19.05.40.05; Wed, 19 Sep 2018 05:40:20 -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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=m2vIcWje; 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 S1732114AbeISSQt (ORCPT + 99 others); Wed, 19 Sep 2018 14:16:49 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:60808 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730876AbeISSQr (ORCPT ); Wed, 19 Sep 2018 14:16:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=gdmlnihdyKW+x3QbLohzUu8kKtbNWAYX/WDsFSCvjvA=; b=m2vIcWjeDw2Yl6j6DWRe0rlIC ic8QHpoqcJhooA4XEUXd5Jh38AQrn2Jr4KLIf1pQP+hWIpxRasQ7O1d3BEV8fUDW6I+pOQ0xRHXru nlr30UMcV2ZQ66cSijeGnqPkS0FAbs3jVrhijoWcepVR9u07NgVLN0nym1sUGmVPNMLhMixu1yRbN zX4xsG0Zs2xWaFSDYHpSQgyJRdPG/H6z0vMXNoaQwaHf/KgKJGCMe9rNuoRvw8m2tyZEeQ+KStEWW CzF5/K80Ei9ki6OGemYQ6NX38ln0h6mF7U2w1n4t3AAxKG0NF0abIFy/OmXK8i2THir4mYUyWoMMn OnAgJtsVg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1g2bkp-0007Zb-FF; Wed, 19 Sep 2018 12:38:51 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2378E2024E448; Wed, 19 Sep 2018 14:38:49 +0200 (CEST) Date: Wed, 19 Sep 2018 14:38:49 +0200 From: Peter Zijlstra To: Martin Schwidefsky Cc: will.deacon@arm.com, aneesh.kumar@linux.vnet.ibm.com, akpm@linux-foundation.org, npiggin@gmail.com, linux-arch@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux@armlinux.org.uk, heiko.carstens@de.ibm.com, Linus Torvalds Subject: Re: [PATCH 2/2] s390/tlb: convert to generic mmu_gather Message-ID: <20180919123849.GF24124@hirez.programming.kicks-ass.net> References: <20180918125151.31744-1-schwidefsky@de.ibm.com> <20180918125151.31744-3-schwidefsky@de.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180918125151.31744-3-schwidefsky@de.ibm.com> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 18, 2018 at 02:51:51PM +0200, Martin Schwidefsky wrote: > +#define pte_free_tlb pte_free_tlb > +#define pmd_free_tlb pmd_free_tlb > +#define p4d_free_tlb p4d_free_tlb > +#define pud_free_tlb pud_free_tlb > @@ -121,9 +62,18 @@ static inline void tlb_remove_page_size(struct mmu_gather *tlb, > * page table from the tlb. > */ > static inline void pte_free_tlb(struct mmu_gather *tlb, pgtable_t pte, > + unsigned long address) > { > + __tlb_adjust_range(tlb, address, PAGE_SIZE); > + tlb->mm->context.flush_mm = 1; > + tlb->freed_tables = 1; > + tlb->cleared_ptes = 1; > + /* > + * page_table_free_rcu takes care of the allocation bit masks > + * of the 2K table fragments in the 4K page table page, > + * then calls tlb_remove_table. > + */ > + page_table_free_rcu(tlb, (unsigned long *) pte, address); (whitespace damage, fixed) Also, could you perhaps explain the need for that page_table_alloc/page_table_free code? That is, I get the comment about using 2K page-table fragments out of 4k physical page, but why this custom allocator instead of kmem_cache? It feels like there's a little extra complication, but it's not immediately obvious what. > } We _could_ use __pte_free_tlb() here I suppose, but... > /* > @@ -139,6 +89,10 @@ static inline void pmd_free_tlb(struct mmu_gather *tlb, pmd_t *pmd, > if (tlb->mm->context.asce_limit <= _REGION3_SIZE) > return; > pgtable_pmd_page_dtor(virt_to_page(pmd)); > + __tlb_adjust_range(tlb, address, PAGE_SIZE); > + tlb->mm->context.flush_mm = 1; > + tlb->freed_tables = 1; > + tlb->cleared_puds = 1; > tlb_remove_table(tlb, pmd); > } > > @@ -154,6 +108,10 @@ static inline void p4d_free_tlb(struct mmu_gather *tlb, p4d_t *p4d, > { > if (tlb->mm->context.asce_limit <= _REGION1_SIZE) > return; > + __tlb_adjust_range(tlb, address, PAGE_SIZE); > + tlb->mm->context.flush_mm = 1; > + tlb->freed_tables = 1; > + tlb->cleared_p4ds = 1; > tlb_remove_table(tlb, p4d); > } > > @@ -169,19 +127,11 @@ static inline void pud_free_tlb(struct mmu_gather *tlb, pud_t *pud, > { > if (tlb->mm->context.asce_limit <= _REGION2_SIZE) > return; > + tlb->mm->context.flush_mm = 1; > + tlb->freed_tables = 1; > + tlb->cleared_puds = 1; > tlb_remove_table(tlb, pud); > } It's that ASCE limit that makes it impossible to use the generic helpers, right?