From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B0680C47095 for ; Tue, 8 Jun 2021 01:48:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 542E061287 for ; Tue, 8 Jun 2021 01:48:09 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 542E061287 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id DF1726B0074; Mon, 7 Jun 2021 21:48:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA19F6B0075; Mon, 7 Jun 2021 21:48:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1B316B0078; Mon, 7 Jun 2021 21:48:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0060.hostedemail.com [216.40.44.60]) by kanga.kvack.org (Postfix) with ESMTP id 8DEC36B0074 for ; Mon, 7 Jun 2021 21:48:08 -0400 (EDT) Received: from smtpin38.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 318122484 for ; Tue, 8 Jun 2021 01:48:08 +0000 (UTC) X-FDA: 78228871056.38.702768F Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf09.hostedemail.com (Postfix) with ESMTP id 3D3246000141 for ; Tue, 8 Jun 2021 01:48:06 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 8208860FE4; Tue, 8 Jun 2021 01:48:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1623116886; bh=Q+5SvaOmqmPqR5Wg8GMpvtupvlOuAHY76M4MzKRjOlg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=woVcnjT2gvMlMWupzbm2RW1aHD1OpFrxMPpGTUAlHEqwXyI+cqSEqpahSce9sUa23 PX7XyEWUPXze2G2Xc83G0Hs999jBFcv3Pkf8Fj6xeYUV1QWlNdJO3BDpVcAT4dcFoC SQ8y+ueymlzsAPBdddPwS27YmwAOpFQ5DXJ/VzSQ= Date: Mon, 7 Jun 2021 18:48:05 -0700 From: Andrew Morton To: Nicholas Piggin Cc: Anton Blanchard , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, Andy Lutomirski , Randy Dunlap Subject: Re: [PATCH v4 1/4] lazy tlb: introduce lazy mm refcount helper functions Message-Id: <20210607184805.eddf8eb26b80e8af85d5777e@linux-foundation.org> In-Reply-To: <1623116020.vyls9ehp49.astroid@bobo.none> References: <20210605014216.446867-1-npiggin@gmail.com> <20210605014216.446867-2-npiggin@gmail.com> <20210607164934.d453adcc42473e84beb25db3@linux-foundation.org> <1623116020.vyls9ehp49.astroid@bobo.none> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 3D3246000141 Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=woVcnjT2; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Stat-Signature: rn9efcqq6yjb5fyy1hx65s1mu57n954q X-HE-Tag: 1623116886-242493 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, 08 Jun 2021 11:39:56 +1000 Nicholas Piggin wrote: > > Looks like a functional change. What's happening here? > > That's kthread_use_mm being clever about the lazy tlb mm. If it happened > that the kthread had inherited a the lazy tlb mm that happens to be the > one we want to use here, then we already have a refcount to it via the > lazy tlb ref. > > So then it doesn't have to touch the refcount, but rather just converts > it from the lazy tlb ref to the returned reference. If the lazy tlb mm > doesn't get a reference, we can't do that. Please cover this in the changelog and perhaps a code comment.