Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2610638imm; Fri, 20 Jul 2018 01:32:00 -0700 (PDT) X-Google-Smtp-Source: AAOMgpci1Mc4KzzF+QYLZSd64+/J9ctCZ8IYK4TQIdIZfnKJVPDq1moAG8diLwYpS/WULXHTfd3W X-Received: by 2002:a63:4951:: with SMTP id y17-v6mr1219267pgk.32.1532075520290; Fri, 20 Jul 2018 01:32:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532075520; cv=none; d=google.com; s=arc-20160816; b=CM2UwdEdYO3C5qHmOX1ssdwZ7fvl1hGWTxLd1SOfDiAeCqqFvLp8zbPm+itvG8T/i+ mqwTyXaAPRVjb/V7rjiGr73wTYPdjwwo05HockKe/nhb4Fs1XcmsW+urhuuixxg0RFMY bHgTLu8mBMMLM2myyzlRUyJ9ptP/RnT9Af5msDz6SJHAtbMakVMBqVo7JmsyysHTz9D/ t1axeNhIGYMh24Plh+vnmHQBHU/XquHDYH5Y/WMx0JjbRCiaMdLFL7s+LB2wKk1ruCxN hJdeEQ+edN91s6jKSQNI5699q2Nzfv/IqPrvtcZiItPd0657pgY2fMH4Yksi7KXhm4m6 uhSg== 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:arc-authentication-results; bh=s6dxkB0haAhsj4RtLapHFb+z/mLPPQaN3JNr93HIAIo=; b=ecW/+zgOYv5LBWAWrS9afE+lKY2wCZKwm+3D3HA6OsD00JcKzdItmEDOMfR2v1+CsL 2KkyBPsSdJ5qqQ09tkB3VtDxSAdg3VgUS860arnZk48/J28Nv4hgtF8M0xVRh6vqFVKF tWder/iWvqF3YKSV7Lq7LeD1js4MkG+G+ps7905WfdbKXu1sQzTLuIK4kYXWVZOEV96o zINmGyuEquO5ppnzp7slU2WcWLlxLB7GRBBwi0cREe9YZ99AtxHt2WHs/m0NkauGx/iY PZ6rWlheSrxWBlH3BQWpOQrlW+ivGOiXrO8qdl3dd+eutMdFQ22CLHKp2xL80OW0rMQW f91w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=PPbp7Sao; 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 m86-v6si1385557pfj.48.2018.07.20.01.31.45; Fri, 20 Jul 2018 01:32:00 -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=PPbp7Sao; 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 S1728302AbeGTJRm (ORCPT + 99 others); Fri, 20 Jul 2018 05:17:42 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:51674 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727201AbeGTJRm (ORCPT ); Fri, 20 Jul 2018 05:17:42 -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=s6dxkB0haAhsj4RtLapHFb+z/mLPPQaN3JNr93HIAIo=; b=PPbp7SaozxFGqNW0jIMqQ9BuX EmHDPSqPJd7fZwcRWq3JVjQJ6DoMuud2Qnj5YY4DfC6VY9L/pvNXWk4BblB+RcMW7VefAWPGEGbDj c8HmsXT3sPT5nfoB1UObCPFe18iDrQl/awDtVyLP6BWKbQo5U289FbcV6iT00mx6LfCXRkMmWtFxN C29vJu0b9vPenuBJd2Z6rcd1gcGGmgoNZvQ8mvbjbbpvA9bkLRk2otbITPvob7CzEcHExqH86fKMP mQRgH6VjikQDkayDN3xGLYPFcW5d+tMAlA7MHmku2FNoreASMDFNC4BpLgucuA+Y2yD5iSEngHwdA xo00Go3XA==; 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 1fgQnq-0005CI-AN; Fri, 20 Jul 2018 08:30:18 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A165120275F47; Fri, 20 Jul 2018 10:30:16 +0200 (CEST) Date: Fri, 20 Jul 2018 10:30:16 +0200 From: Peter Zijlstra To: Andy Lutomirski Cc: Rik van Riel , Vitaly Kuznetsov , Juergen Gross , Boris Ostrovsky , linux-arch , Will Deacon , Catalin Marinas , linux-s390@vger.kernel.org, Benjamin Herrenschmidt , linuxppc-dev , LKML , X86 ML , Mike Galbraith , kernel-team , Ingo Molnar , Dave Hansen Subject: Re: [PATCH 4/7] x86,tlb: make lazy TLB mode lazier Message-ID: <20180720083016.GN2494@hirez.programming.kicks-ass.net> References: <20180716190337.26133-1-riel@surriel.com> <20180716190337.26133-5-riel@surriel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Thu, Jul 19, 2018 at 10:04:09AM -0700, Andy Lutomirski wrote: > I added some more arch maintainers. The idea here is that, on x86 at > least, task->active_mm and all its refcounting is pure overhead. When > a process exits, __mmput() gets called, but the core kernel has a > longstanding "optimization" in which other tasks (kernel threads and > idle tasks) may have ->active_mm pointing at this mm. This is nasty, > complicated, and hurts performance on large systems, since it requires > extra atomic operations whenever a CPU switches between real users > threads and idle/kernel threads. > > It's also almost completely worthless on x86 at least, since __mmput() > frees pagetables, and that operation *already* forces a remote TLB > flush, so we might as well zap all the active_mm references at the > same time. So I disagree that active_mm is complicated (the code is less than ideal but that is actually fixable). And aside from the process exit case, it does avoid CR3 writes when switching between user and kernel threads (which can be far more often than exit if you have longer running tasks). Now agreed, recent x86 work has made that less important. And I of course also agree that not doing those refcount atomics is better.