Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2734035imm; Fri, 20 Jul 2018 04:05:40 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcSCpowLUOfm+rejh07UF4mqK0sqrW3n8R4y4wIhG5dewMETIV+juS6btvljqjuv8j6zOr3 X-Received: by 2002:a17:902:3041:: with SMTP id u59-v6mr1679533plb.208.1532084740369; Fri, 20 Jul 2018 04:05:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532084740; cv=none; d=google.com; s=arc-20160816; b=X+Q6rNeQFs+gMwo5dbZnMSSUAsruhaILbrXFcB9krGy+6y3WLhtHfKvAnzLYrpmKPy 5DwhKIvI9tYgkKIt2/5WjEm4rQpneG9aDQI9UhY1G2CPD1wipTw5xWE7w20cml6ARSct KtfK6HUuiNCOBPGmxLod3/x+1CnGdN4ng+OWdc0dgYO7KZTUVn8k3qL0AYqendavyL+B zSO419iokN7U2DYW0wB5t8wNz34fV5UdfPes6ytWDv4ODNBz9KYAwemweQ8Dpe1f/zNC c/Klo5AB+BDGgeg9+GnJhmdrz3H1gpeCWIpdXXbYcKDTTwdXEyDLF9UVViQC4Gb6Rytb w1zw== 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=7ouedsEnVmJZXV8iKYA9Gm2tBgsZ9qzzF0EIfIEvWSw=; b=KNhuAmxOxN8NHS+6anBlWCPao+PtDKZz1W6DEKkg+SoQ99r/C73ABvs/v0acWy8ObC /SBKw1stZqu1DECtNyrKsoRpc7hz4OMz91HZKCXf6unFnYFxYjvYILVWC3XEDaCiEnu9 zPF8imhgslqbVUFELwBIok0DID8CWVGtbDwJFTq73AsCH44/y8NjwslotMjAwlRrtPJY 0wO39Wb247OAFyokxJj95S4CQ9wFHJ/OIQSVdd7RSlMV1cpxCMoFG/Zq/SUrh4hIQtWF HstZMYHtpEQ+Ajf5Dg8PaNXHWGBbaxnrg4JW/Pn8/K/qR/QFx6AN8jh8s8TEDIFO0JtK 3yLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=U2ZRKMx0; 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 j135-v6si1674751pfd.207.2018.07.20.04.05.25; Fri, 20 Jul 2018 04:05:40 -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=U2ZRKMx0; 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 S1728834AbeGTLwU (ORCPT + 99 others); Fri, 20 Jul 2018 07:52:20 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:41296 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727408AbeGTLwU (ORCPT ); Fri, 20 Jul 2018 07:52:20 -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=7ouedsEnVmJZXV8iKYA9Gm2tBgsZ9qzzF0EIfIEvWSw=; b=U2ZRKMx0MAJYDKjDby+eP7Dgo itPVm3SsKippAICD641iA+sIxjFZnJCmXnG4Velz97S/pYMJVA2mAiNPb+2/u2WhsUJlI2axNbQwI QTHWZo6mjn22KMnNy+r+4CYlUYGZO1bsC2SjVkKfxofPxUfW0s64RygtER4uLBNgE5xhVi5sQSoSD GtHRT0AH1laG59r87sLMuyCvy1itmp0T3X7ZZcpd+vYWqfVimvnew/APEXxnBP9Im5dgxA/VNr44j HbVJGcJ4DZJF+opsvb3HxVA90xCI5ByO1GEq0d5vC9YPZ2wMo2f/eIiGwvAae8XMfVdd2t6Q6XBMl 2Sca4LwEg==; 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 1fgTD1-0006o3-4h; Fri, 20 Jul 2018 11:04:27 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id CDAC920275F3E; Fri, 20 Jul 2018 13:04:24 +0200 (CEST) Date: Fri, 20 Jul 2018 13:04:24 +0200 From: Peter Zijlstra To: Andy Lutomirski Cc: Rik van Riel , Vitaly Kuznetsov , Andy Lutomirski , 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: <20180720110424.GA2512@hirez.programming.kicks-ass.net> References: <20180716190337.26133-1-riel@surriel.com> <20180716190337.26133-5-riel@surriel.com> <20180720093239.GO2494@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180720093239.GO2494@hirez.programming.kicks-ass.net> 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 Fri, Jul 20, 2018 at 11:32:39AM +0200, Peter Zijlstra wrote: > + if (!next->mm) { // to kernel > + enter_lazy_tlb(prev->active_mm, next); > + > +#ifdef ARCH_NO_ACTIVE_MM > + next->active_mm = prev->active_mm; > + if (prev->mm) // from user > + mmgrab(prev->active_mm); else prev->active_mm = NULL; > +#endif > + } else { // to user > + switch_mm_irqs_off(prev->active_mm, next->mm, next); > + > +#ifdef ARCH_NO_ACTIVE_MM > + if (!prev->mm) { // from kernel > + /* will mmdrop() in finish_task_switch(). */ > + rq->prev_mm = prev->active_mm; > + prev->active_mm = NULL; > + } > +#endif > }