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=-7.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 32DDCC4743F for ; Tue, 8 Jun 2021 16:20:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DA00B61249 for ; Tue, 8 Jun 2021 16:20:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DA00B61249 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 6E8E56B0070; Tue, 8 Jun 2021 12:20:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6BF2D6B0071; Tue, 8 Jun 2021 12:20:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5AF226B0072; Tue, 8 Jun 2021 12:20:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0165.hostedemail.com [216.40.44.165]) by kanga.kvack.org (Postfix) with ESMTP id 2BD326B0070 for ; Tue, 8 Jun 2021 12:20:08 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id C4283DB3C for ; Tue, 8 Jun 2021 16:20:07 +0000 (UTC) X-FDA: 78231068454.15.B6CB52D Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf30.hostedemail.com (Postfix) with ESMTP id 96C1DE000263 for ; Tue, 8 Jun 2021 16:20:05 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 46D7A6128E; Tue, 8 Jun 2021 16:20:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1623169206; bh=qkkyaNSTG8jKDhH3l2/+Ytp2W/YqYbwhA582jK1SRa0=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Be8aPjdZ0EtnXdxKyRzx3MB64aOGcU7P5UxQ60lFZJ+Mi3PrAXxve5Kh7ozb6Tst1 qvq7+rUkGafYRbTp1qyWzVF2n74c0jxpemsTz89k34Sg5GKkitFEgkg/Hy8xQTBO/G 4Lk64TKYlnvU5TH0F2//tJ9AAIFZwe3CqujZmuLOImNtMXGTiLdshYsjGnuiYZT7Vm reo0ICVt6+1ECIYZjX5QbWJ/c1/dTnob5vROygOAmKdZSOrmAwcSFXqsTDg4EbYUTY lA/Rbq8XmdekAwv73UgdeNdNqpVAQy91fVbb2tohvlwpmV1x1nhF3fPrwidswlVRB9 DfX8/CWS7kisg== Subject: Re: [PATCH v4 2/4] lazy tlb: allow lazy tlb mm refcounting to be configurable To: Nicholas Piggin , Andrew Morton Cc: Randy Dunlap , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-mm@kvack.org, Anton Blanchard References: <20210605014216.446867-1-npiggin@gmail.com> <20210605014216.446867-3-npiggin@gmail.com> From: Andy Lutomirski Message-ID: <8ac1d420-b861-f586-bacf-8c3949e9b5c4@kernel.org> Date: Tue, 8 Jun 2021 09:20:05 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <20210605014216.446867-3-npiggin@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 96C1DE000263 Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Be8aPjdZ; spf=pass (imf30.hostedemail.com: domain of luto@kernel.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=luto@kernel.org; dmarc=pass (policy=none) header.from=kernel.org X-Stat-Signature: 3p7pxofh4h6a8z4e8jyes845pq4afs5k X-HE-Tag: 1623169205-869703 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 6/4/21 6:42 PM, Nicholas Piggin wrote: > Add CONFIG_MMU_TLB_REFCOUNT which enables refcounting of the lazy tlb mm > when it is context switched. This can be disabled by architectures that > don't require this refcounting if they clean up lazy tlb mms when the > last refcount is dropped. Currently this is always enabled, which is > what existing code does, so the patch is effectively a no-op. > > Rename rq->prev_mm to rq->prev_lazy_mm, because that's what it is. I am in favor of this approach, but I would be a lot more comfortable with the resulting code if task->active_mm were at least better documented and possibly even guarded by ifdefs. x86 bare metal currently does not need the core lazy mm refcounting, and x86 bare metal *also* does not need ->active_mm. Under the x86 scheme, if lazy mm refcounting were configured out, ->active_mm could become a dangling pointer, and this makes me extremely uncomfortable. So I tend to think that, depending on config, the core code should either keep ->active_mm [1] alive or get rid of it entirely. [1] I don't really think it belongs in task_struct at all. It's not a property of the task. It's the *per-cpu* mm that the core code is keeping alive for lazy purposes. How about consolidating it with the copy in rq? I guess the short summary of my opinion is that I like making this configurable, but I do not like the state of the code. --Andy