Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4962666yba; Mon, 13 May 2019 02:59:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqzG3VLqrenKFTtfqb7JJG3jXHMbNeYYecYWOk6qqHFSyBV4P8deWTO7z+yeH3su4doQi3xR X-Received: by 2002:a17:902:6b82:: with SMTP id p2mr28428735plk.99.1557741541605; Mon, 13 May 2019 02:59:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557741541; cv=none; d=google.com; s=arc-20160816; b=lvsMIu2GqTBru2eZX+FqSdBTeFbYuFy+ckkD5CrDTC1FeZNDUWhIBZqIYBGQoaS9Bv gHdT8atOhwnxRQpqlcJ6m4/wqLXaR8TIUwp1aMhI6w9u77M1rPKmtkCbhjJG9SfUdeqq S0X4Vum+OywouYsG5UfdJGS347I7XVHHBUzDQ7BNl68SPVw4sTUOOJdZN7r+XmlEmhss XyRgw7rgwxm8tFaHL0QZRFOcu5r6cYv/7tVyAiGbPTm67aowTq8xfUFhfZHGY+3eeEdd Lmo0Ot0PMh5SJkDMCfM9gulhXTdw0qXw1R0hmo3ZTZJi9Ni5RJ07HJzlPbY8msWhbLrC eNew== 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=FhRnavH5ISIIL5pl8TyT+ztasWjBJfJsuvguEoKrBnk=; b=hPbVrqHbhdODyKP/juqubUiKbnO9aI2nlFiK4D8gL1fNDAmjjtG2TaKnC/CsvRfT/r rgfK8HCS+/9YWmAQq5LDJW2AQOmtYe6NBn++rBaUcOi0mhBFmFJt0tZ3Wlo546x9xlXe qMF8ah2nYLJBDRQA+brclDWuPWoIfrPsiMubvr6R+YMlgM3DlD/epVM41J9XTuZDVlDG PWOGrxuPHuQF8A0Pi0mfNI1/hutZL4U9kSqR40oz3wotEt+cxmufI7U/CGKK2T7zVnoM 9tKAPy0KFGhummEvaRQdebgkyuuhZ7HpTfrPZR3LOoiVqjB94Pq/CrSlsuccoo2KFFnG jBTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EvAbLVwU; 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 g3si1195565pgc.156.2019.05.13.02.58.45; Mon, 13 May 2019 02:59:01 -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=EvAbLVwU; 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 S1728588AbfEMJMP (ORCPT + 99 others); Mon, 13 May 2019 05:12:15 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:56162 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726132AbfEMJMP (ORCPT ); Mon, 13 May 2019 05:12:15 -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=FhRnavH5ISIIL5pl8TyT+ztasWjBJfJsuvguEoKrBnk=; b=EvAbLVwUdc20zwJRefzd8QXJc xGFN34vOXzCUBVBHMhCvseLFXe61OQl6jTYmI2IpoiF9NNOUAeidWxIdaXszHhOK2X4r7hDNLaykV 49pGvyK6Pe3kV8vOdLD5SMVPTkx4njIp7Rjq3/I8BEcLabvbNulz/3l6BHOJmklPrznaTshp+UpOx kFaXb295xKAyC0BS5R96yYYxOexobeYwZNvi69E7DTKFRtFrA6aEZjbLlEMYOW6EcWGUYJUNjOC4y TQcZWQE/WrzhWeSjXI8wcoe0LHeXtYXIZBSUhs9LnSBw9IViT06alNECta0qlYxO7RU5kHB8K3q93 RAjmE9aqg==; 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 1hQ70B-0002mG-NM; Mon, 13 May 2019 09:12:07 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id DB1D02029F888; Mon, 13 May 2019 11:12:05 +0200 (CEST) Date: Mon, 13 May 2019 11:12:05 +0200 From: Peter Zijlstra To: Nadav Amit Cc: Yang Shi , "jstancek@redhat.com" , Andrew Morton , "stable@vger.kernel.org" , Linux-MM , LKML , "Aneesh Kumar K . V" , Nick Piggin , Minchan Kim , Mel Gorman , Will Deacon Subject: Re: [PATCH] mm: mmu_gather: remove __tlb_reset_range() for force flush Message-ID: <20190513091205.GO2650@hirez.programming.kicks-ass.net> References: <1557264889-109594-1-git-send-email-yang.shi@linux.alibaba.com> <20190509083726.GA2209@brain-police> <20190509103813.GP2589@hirez.programming.kicks-ass.net> <20190509182435.GA2623@hirez.programming.kicks-ass.net> <04668E51-FD87-4D53-A066-5A35ABC3A0D6@vmware.com> <20190509191120.GD2623@hirez.programming.kicks-ass.net> <7DA60772-3EE3-4882-B26F-2A900690DA15@vmware.com> <20190513083606.GL2623@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190513083606.GL2623@hirez.programming.kicks-ass.net> 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 Mon, May 13, 2019 at 10:36:06AM +0200, Peter Zijlstra wrote: > On Thu, May 09, 2019 at 09:21:35PM +0000, Nadav Amit wrote: > > It may be possible to avoid false-positive nesting indications (when the > > flushes do not overlap) by creating a new struct mmu_gather_pending, with > > something like: > > > > struct mmu_gather_pending { > > u64 start; > > u64 end; > > struct mmu_gather_pending *next; > > } > > > > tlb_finish_mmu() would then iterate over the mm->mmu_gather_pending > > (pointing to the linked list) and find whether there is any overlap. This > > would still require synchronization (acquiring a lock when allocating and > > deallocating or something fancier). > > We have an interval_tree for this, and yes, that's how far I got :/ > > The other thing I was thinking of is trying to detect overlap through > the page-tables themselves, but we have a distinct lack of storage > there. We might just use some state in the pmd, there's still 2 _pt_pad_[12] in struct page to 'use'. So we could come up with some tlb generation scheme that would detect conflict.