Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp704951ybl; Wed, 4 Dec 2019 09:31:17 -0800 (PST) X-Google-Smtp-Source: APXvYqyrM5Gx2NA1Mws00xiJD3Atptees4LRlKCf9HLHhJM6GXYfMnx4KxEaffvPXCXFipBbyxQV X-Received: by 2002:a54:4085:: with SMTP id i5mr3636321oii.17.1575480676935; Wed, 04 Dec 2019 09:31:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575480676; cv=none; d=google.com; s=arc-20160816; b=W6fGhe5/mTmEG9w6n8c9nOIhsO9hfK6wuMh3jY64VdI/Ny/fOXs6dIlMGesUcErDOz eTQMfdfekKzC9Sa59f0hX/jCt141LdNv8jojlc6ywV4o/fm2GXy6n9OZVLnLLW88W9+X DNYs0Z2wDUHIHyOyw89P+x2Ggu36ki52je/xthwk685H7NuZdcGi9A7BjDIMzMYzlrlY SJo2WglKVVviNj6tbIcVPlPqX+Z8oIqkFP0TSoWmVfVnv2bzghqI4dQm/YhSJfOSt4aq MiWW8/zBgFRLXgi9PddXLLLvX4Zj5Y62QKbGcL81crU/zUKOack3nFLE8cF0xGFFB+zN cqqw== 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=yrRU3PisMm2st1jba/Bb8HxzI37AaG7nr9igFrhou+0=; b=y8gFycfBIcoqoOBC5KencU7ajDaasnWKezvAe1GbnLYyppe7l5N+ILMvK0oGzHxUzF veaSbY4I5nQXSOa9v0n6XhukgQy1dH5rZ2GOZxkzVyl2+IuyWmwIOvms3HruTFbKymMu Zu6L+ssInK4MhrStcJU2yCvcG8EENfjiPjMgCtp7k4+wTibMn36vfCvygak8KlHAWr26 akXvWFxAQPjoZLqfLVitLMKYal9WS5WDWYNmC6jkRn8v3nuU+d+f9H1HgwiH7jU5xCNs PSLOXlOo04QgxMbDD7aAx1lk5zb2Y9g3tuyCZQ2zSPKlUo5K+/NIt0dmfPb7ndQOjrw2 nAdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=YzSukzBJ; 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 y7si3740629otq.62.2019.12.04.09.31.03; Wed, 04 Dec 2019 09:31:16 -0800 (PST) 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=YzSukzBJ; 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 S1728832AbfLDQmS (ORCPT + 99 others); Wed, 4 Dec 2019 11:42:18 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:33556 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727989AbfLDQmS (ORCPT ); Wed, 4 Dec 2019 11:42:18 -0500 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=yrRU3PisMm2st1jba/Bb8HxzI37AaG7nr9igFrhou+0=; b=YzSukzBJzdqU/YRJch4sntx/E sCZkgAXqyU8Ej6+v4ETINlSOyOuAcafjK2W4U6Fs//ZIYBczlusZ/pgQ44bR+n0nAlFM5eO8MirWJ qIjAFz6sXyFenhc9WNLc4StTDHvzQCcnIDggAMNIzuK8vkIlf24fOfOOlgl1Iz+UA11rQ08SXyC+w G1c3Dr+c8/Q/M6YpvfUOh3xnFX89tF5/200Y85jgFFVYZK0RQqPmSFlx+U6ud+y1xRZMmXFkg9eJb mG5q2RuAIdcWaLcilm+sE8on/C9JnC3syLBE4KkjSLE60YV8AStvK2Pb7JqHReYLAWBPh9Yjy6TQe BG0N42Dhg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1icXil-0007xP-5G; Wed, 04 Dec 2019 16:41:47 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 8ABC93006E3; Wed, 4 Dec 2019 17:40:26 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5D67A20B83957; Wed, 4 Dec 2019 17:41:43 +0100 (CET) Date: Wed, 4 Dec 2019 17:41:43 +0100 From: Peter Zijlstra To: Geert Uytterhoeven Cc: Will Deacon , "Aneesh Kumar K.V" , Andrew Morton , Nicholas Piggin , Linux-Arch , Linux MM , Linux Kernel Mailing List , Russell King , Heiko Carstens , Rik van Riel , Yoshinori Sato , Rich Felker , Linux-sh list , Guenter Roeck Subject: Re: [PATCH v6 10/18] sh/tlb: Convert SH to generic mmu_gather Message-ID: <20191204164143.GB2810@hirez.programming.kicks-ass.net> References: <20190219103148.192029670@infradead.org> <20190219103233.443069009@infradead.org> <20191204104733.GR2844@hirez.programming.kicks-ass.net> <20191204133454.GW2844@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 04, 2019 at 04:07:53PM +0100, Geert Uytterhoeven wrote: > On Wed, Dec 4, 2019 at 2:35 PM Peter Zijlstra wrote: > > Does this fare better? > > Yes. Migo-R is happy again. > Tested-by: Geert Uytterhoeven > > > --- a/arch/sh/include/asm/pgalloc.h > > +++ b/arch/sh/include/asm/pgalloc.h > > @@ -36,9 +36,7 @@ do { \ > > #if CONFIG_PGTABLE_LEVELS > 2 > > #define __pmd_free_tlb(tlb, pmdp, addr) \ > > do { \ > > - struct page *page = virt_to_page(pmdp); \ > > - pgtable_pmd_page_dtor(page); \ > > - tlb_remove_page((tlb), page); \ > > + pmd_free((tlb)->mm, (pmdp)); \ > > } while (0); > > #endif OK, so I was going to write a Changelog to go with that, but then I realized that while this works and is similar to before the patch, I'm not sure this is in fact correct. With this on (and also before) we're freeing the PMD before we've done the TLB invalidate, that seems wrong! Looking at the size of that pmd_cache, that looks to be 30-(12+12-3)+3 == 12, which is exactly 1 page, for PAGE_SIZE_4K, less for the larger pages. I'm thinking perhaps we should do something like the below instead? --- arch/sh/mm/pgtable.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/arch/sh/mm/pgtable.c b/arch/sh/mm/pgtable.c index 5c8f9247c3c2..fac7e822fd0c 100644 --- a/arch/sh/mm/pgtable.c +++ b/arch/sh/mm/pgtable.c @@ -5,9 +5,6 @@ #define PGALLOC_GFP GFP_KERNEL | __GFP_ZERO static struct kmem_cache *pgd_cachep; -#if PAGETABLE_LEVELS > 2 -static struct kmem_cache *pmd_cachep; -#endif void pgd_ctor(void *x) { @@ -23,11 +20,6 @@ void pgtable_cache_init(void) pgd_cachep = kmem_cache_create("pgd_cache", PTRS_PER_PGD * (1< 2 - pmd_cachep = kmem_cache_create("pmd_cache", - PTRS_PER_PMD * (1< 2 */