From patchwork Thu Feb 22 19:09:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yosry Ahmed X-Patchwork-Id: 13567983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5EEC6C5478C for ; Thu, 22 Feb 2024 19:09:17 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C720F6B007E; Thu, 22 Feb 2024 14:09:16 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C20D26B0080; Thu, 22 Feb 2024 14:09:16 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE8AE6B0081; Thu, 22 Feb 2024 14:09:16 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 9B6E46B007E for ; Thu, 22 Feb 2024 14:09:16 -0500 (EST) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 60317140F3A for ; Thu, 22 Feb 2024 19:09:16 +0000 (UTC) X-FDA: 81820377912.07.C4BBC60 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf27.hostedemail.com (Postfix) with ESMTP id 9C1C640020 for ; Thu, 22 Feb 2024 19:09:14 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=SbYAy58K; spf=pass (imf27.hostedemail.com: domain of 32ZvXZQoKCKQcSWVcELQIHKSSKPI.GSQPMRYb-QQOZEGO.SVK@flex--yosryahmed.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=32ZvXZQoKCKQcSWVcELQIHKSSKPI.GSQPMRYb-QQOZEGO.SVK@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1708628954; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=nIzMjlB25RgjrxXtl1pB1geOeDMH3Njm73h3nfH079U=; b=bMWgYYs06g76uN8aflvzQPiDpdLs5mE3H1iaigC81iM9Nxurg0cH9xrzfA8J0trIkBsHSw O7KBFIHE9dajPdJWRNSIpslZ/sp4s/75thkhcFPaN8ryEb+cZCBhdsCRQe+DufC9Sjp7NU 7fBN+Z1MyZVkMljWV+cyC7Cs2C1qGYU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1708628954; a=rsa-sha256; cv=none; b=jvbI1QWAxGzO7yEE5BCMuEK9xLKK1JxVgIeD7QXQaqIlwoEBrgBbLwZeam7eC2YPMvx7TF rBtA32cJ86aBrw+lGDF1TTBRW12Ql+djr/kTaou1fYJFpIPfyNmlwYH2V/9XUJQ0ItOhYn 9XTqCL+22utdFU2/rE2BE5Dg6KhN0No= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=SbYAy58K; spf=pass (imf27.hostedemail.com: domain of 32ZvXZQoKCKQcSWVcELQIHKSSKPI.GSQPMRYb-QQOZEGO.SVK@flex--yosryahmed.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=32ZvXZQoKCKQcSWVcELQIHKSSKPI.GSQPMRYb-QQOZEGO.SVK@flex--yosryahmed.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-607838c0800so13110337b3.1 for ; Thu, 22 Feb 2024 11:09:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708628953; x=1709233753; darn=kvack.org; h=cc:to:from:subject:message-id:mime-version:date:from:to:cc:subject :date:message-id:reply-to; bh=nIzMjlB25RgjrxXtl1pB1geOeDMH3Njm73h3nfH079U=; b=SbYAy58KQF2JBQDQMvzZDArh7sQqu00vFBs/U0Aci12PGVe7bmDJqz11WPcfSmKLrE /BlZY0DEtG8Df5xlqSVvYSzTe3yd5qgigIlKdoJjLJIhLLSOXC8RvVc48ZAP+4ayNaau 84LF+GJiqgcpYwlu9FWd17EcAB8tsOFHv/afrAj9qjTUlVZpJaAKk1LanrKou+QCjzWy wyEtq63kH8NFYAg14jllkxcW1OfBnVQCEjP31JhQsr8Xt7jR3ZdKRhh8OdWyF4Fwg4PX uTtdbXYGnEQksOvmBnho2CQ1p1Brm0LPUnI9cOms3hsrkTYEcLyeFCET7eZ87LaIJWcC LmTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708628953; x=1709233753; h=cc:to:from:subject:message-id:mime-version:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=nIzMjlB25RgjrxXtl1pB1geOeDMH3Njm73h3nfH079U=; b=izfJe84uN8r6AOfG8QbKhognXjmo16XiKrt1l3LL/ctBNrSEco08PHCggfplntGCkd 99LjlovkQ6CtcGEzbpK5QI4S44P3fgVsWmcIFINJPp5aUBLwfKyPl+ZT9ILYYstnFQVM jYU74gP6rWpUdwiZytnaQfe8WiZk2xuUGtDrb0Y8PsZRtgpq+2SmEpPKn3XL8THJ3s/I gookRJTzHgu3pUInIU2QrkIqeM3ScajlcBiC8IQyaVSRqL7souhMbyQu7gXnhoqxo82j sXBQ59UOzbtbxqadNhQMxoI32+C6k5XJjt2h2itCTwUzlcfl9m3C+8SqOrHca1yS4pSP 82vA== X-Forwarded-Encrypted: i=1; AJvYcCWjGJlLThZgO1BVjNJMApjAHeyF2jOfvvNwkrGZ8oKDdcMl6pn6c1jgvNz1P1sgB4ypWkdpnhCK4jFjr2bzdjmSwPw= X-Gm-Message-State: AOJu0Yz6zeTXOK4FPAqas9JNx7AYQdFEMug4UHWogOUQl/a8JCC82Q7O BGUFXuMk6QzK9rlVF0j+Gm055Li+jP4QICIBp9vHpGDj3euSb0mPLyb6csjAJiaRFDZamK2X93G CeRdYn6yrBBObF6gGsQ== X-Google-Smtp-Source: AGHT+IFhLOIIoOxOJTeZtK8v5l/nxmb62wdg4S32WZNNAZyEiVU1cXXF13e3K+xCwfoSZI1v2GPL5kT56V9ooklX X-Received: from yosry.c.googlers.com ([fda3:e722:ac3:cc00:20:ed76:c0a8:29b4]) (user=yosryahmed job=sendgmr) by 2002:a25:7496:0:b0:dcc:5463:49a8 with SMTP id p144-20020a257496000000b00dcc546349a8mr657549ybc.6.1708628953740; Thu, 22 Feb 2024 11:09:13 -0800 (PST) Date: Thu, 22 Feb 2024 19:09:10 +0000 Mime-Version: 1.0 X-Mailer: git-send-email 2.44.0.rc1.240.g4c46232300-goog Message-ID: <20240222190911.1903054-1-yosryahmed@google.com> Subject: [PATCH mm-stable 1/2] x86/mm: further clarify switch_mm_irqs_off() documentation From: Yosry Ahmed To: Andrew Morton Cc: Dave Hansen , Ingo Molnar , Thomas Gleixner , Borislav Petkov , Dave Hansen , Andy Lutomirski , Peter Zijlstra , x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Yosry Ahmed X-Stat-Signature: sdj44yxkimcxbfqikkan3fo5wt9nfd6p X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 9C1C640020 X-Rspam-User: X-HE-Tag: 1708628954-237478 X-HE-Meta: U2FsdGVkX1+MDJaDhZEq1VFUk8ZgXT+F4Zg/9NRfYz8m5gO+C1Ah30qno+IfSUWTp4KMrNuMN1GZ0ntL7XQ2BCGn/z5lblbSSsqTKM2uyF/AjuBUALFBErxDB8eMkQuC9i5xEzRI55N02x0M/MmJC6bc/b8iZxdyIhlZah52lsDmzESs4mD+5xKB5SFhjh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rYhDEjLYljhDkrYMYpucetCpe53J95G0jyjQYLDg07m8n6Ibrd5dL7HjMMLvFWHjG277CSwgW+1cunqsUuMU31bcN+NahQKqE9SXCQ8yd8RJRG1KNKQYLhXw1onVBX40QPVRGg9RcKIQ5nM/4eZMF9c+NElVrwOJGVHSJ/HIrZO1vV6na7giJYVLXcexuWayQZqnl8BjOXXQLerOa9EwEU9CxTUhlKxZztBXc7DkZylFDo28lzA7c09i/itmJKD2TkOTOhMklY5a+hrHzcGswpRYiCL6PPBvuis/UiXfltHNeV80zJHo4AT7LWlHWiNWZgt9PwtYphzMmhZqIRlPiI8ORwip4kqElyxpIoGzLfALOotvzZPPCoE05Y61+1o09gtT1UcXNzeATAaR0EV3OzI7ube4yPCRXFQulhZkRBiRd+i/Otpu1oOa73aARkg== 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: List-Subscribe: List-Unsubscribe: Commit accf6b23d1e5a ("x86/mm: clarify "prev" usage in switch_mm_irqs_off()") attempted to clarify x86's usage of the arguments passed by generic code, specifically the "prev" argument the is unused by x86. However, it could have done a better job with the comment above switch_mm_irqs_off(). Rewrite this comment according to Dave Hansen's suggestion. Fixes: accf6b23d1e5 ("x86/mm: clarify "prev" usage in switch_mm_irqs_off()") Suggested-by: Dave Hansen Signed-off-by: Yosry Ahmed Acked-by: Dave Hansen --- arch/x86/mm/tlb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c index bf9605caf24f7..b67545baf6973 100644 --- a/arch/x86/mm/tlb.c +++ b/arch/x86/mm/tlb.c @@ -493,10 +493,10 @@ static inline void cr4_update_pce_mm(struct mm_struct *mm) { } #endif /* - * The "prev" argument passed by the caller does not always match CR3. For - * example, the scheduler passes in active_mm when switching from lazy TLB mode - * to normal mode, but switch_mm_irqs_off() can be called from x86 code without - * updating active_mm. Use cpu_tlbstate.loaded_mm instead. + * This optimizes when not actually switching mm's. Some architectures use the + * 'unused' argument for this optimization, but x86 must use + * 'cpu_tlbstate.loaded_mm' instead because it does not always keep + * 'current->active_mm' up to date. */ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next, struct task_struct *tsk)