Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2317353rda; Tue, 24 Oct 2023 21:34:38 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEK/ZDTJsc8ztpTWYb1UpuyEm+RtOjEJH48h+6zVUhSTLEiNps5nd8EIwNg/jpcxi5s0bs5 X-Received: by 2002:a25:c885:0:b0:d9b:90d3:2b89 with SMTP id y127-20020a25c885000000b00d9b90d32b89mr15859780ybf.28.1698208477710; Tue, 24 Oct 2023 21:34:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698208477; cv=none; d=google.com; s=arc-20160816; b=brSZSYrm5pf9i4CvYvyQrTT0rRiPSdoHLJzSTuXjpvSBDeOBmon+2fTilxoH1CDpG6 chHaHd8TtzQtEc+UKcO2fiRFvKCi1DecZlCvOoc+wvqo2Kd8tA/5nuA7xhgvG2j3Jxea 5GU6QS17dW+Was0tHD4o2E7JEyq8nzOio51OlplSnCZ0b08bWzDIRyq6gEVq9ENNJWAt eTfIt4hS+lNmGBoBu5TAfZNjePFNi74gt1+QCTXx0XvxuCCgXWqFwjCUq9IZp1u5z+7d Em6cJTfQg7OqxtS/oNVZZ23JohYm+ifEHsXFnaktJCNxH3BAdz8S8W29LhieP019rN3t TPJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=gVkIC9fUmLZDVWvlN2mUA1mgD/rtwCOE8cYC+FdYHCM=; fh=ASy8NI95yANsw1XRPWDnCVSL14rwILkvDpwy+CA9TdY=; b=WCFXD8Uy3w6gho+T4xI+KVhNSuTSyaOh3uKwOQhUrqMP4X/ivC6QnqeKGtMIqiZhcr R5d+QX5bfqomuS2IhO334v/0vdfJQcGju6EbhF6hflEpd65LNC4F+I3X4gXkgPDh1Jkg nCVHnL36oBNSdVxrNc+y9wT2azefjiDcMIuXvS7pwI/lufhTgVwYIyVbIcKVQ8GXZGOw Z4n2IbHQ1wbop2az0a4JU7MKoz3E2e1gPAhW8F8/06SXbvLoqhatHSCTSyOheuPqgMsH WDUQA429xOWyctQgY6WBX2VCb2TW2D5O3Widi+GVKUEdNIThw/3X6l6a9iWPFiXmfjcQ 7fNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WBjvNp+H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id v81-20020a25c554000000b00d818c8b1c87si2238263ybe.682.2023.10.24.21.34.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 21:34:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=WBjvNp+H; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 124F880C2479; Tue, 24 Oct 2023 21:34:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229583AbjJYEee (ORCPT + 99 others); Wed, 25 Oct 2023 00:34:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51544 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229456AbjJYEec (ORCPT ); Wed, 25 Oct 2023 00:34:32 -0400 Received: from mail-vk1-xa2a.google.com (mail-vk1-xa2a.google.com [IPv6:2607:f8b0:4864:20::a2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CF54123 for ; Tue, 24 Oct 2023 21:34:31 -0700 (PDT) Received: by mail-vk1-xa2a.google.com with SMTP id 71dfb90a1353d-49ab6c1869dso319881e0c.0 for ; Tue, 24 Oct 2023 21:34:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1698208470; x=1698813270; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gVkIC9fUmLZDVWvlN2mUA1mgD/rtwCOE8cYC+FdYHCM=; b=WBjvNp+HnEACWYPtzRCqLdTSYUvxhIplEm6Tr5U4POMWqwTGDEAiSodQpNSEvZmWEP CMrAlkvBV+gcpkljko+WQcG69kj4zJjWYVnUa2Z1esEHLPPy8CJ4HNPpL7atqVQuJCyc I1tIeLuRZaTRpzPK++is+BHsWP/QWKrEPZoiYecW0fX5zG+U7Hr9ShqUCD1dr8xpsXfm OVHim9my1NzOadPnJtBV3qffeVMxSE4AQZCwRK6ggqTt9SRFnS0fnY8AXFPmLdwY9vdV iCmuJAaf/a+q6eqzSSYNoD6JCbKo/JgMU7uCRIq8/XEaqeV7q4q2CoxMIHTU0si4z2ll s2Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1698208470; x=1698813270; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gVkIC9fUmLZDVWvlN2mUA1mgD/rtwCOE8cYC+FdYHCM=; b=DfdVa6LmU7NePpa6AHppZrLTgEYj4cWaiLgRhSDZbLBzwaPAPJGJpAq+1Qg5OkJ6eS gwXyBhYjxnuIDgKT+8+JbtxEYGSDlV5sgKHS8yInmlY2YjcmIBfcB6nzZiyhYA0LqKMq vMdHOMrei8lTO1vz8KIGFgwiSS6AZZhrqEGu7LgqT7sA7ra+PNquMcEbQncD03t+iM4f Xx3S2xVvzzMw++E0o5lwnjmuLux4WSZxm/nKdIcOmvq/3N3aIdSHGd2ppYeSwK/QH+/u hhBoyU7B1JMlH40XZG3JsB57KIxVBqh6ojhQ0cVgptyPiyojfTcjNpQrmwle7GHZ06VM 1EIA== X-Gm-Message-State: AOJu0YzUCBpY6kAsfk0l0wGWlY74JDH6zI6kA36Biv4uWN0+NU2ffkfS gx4qBu1IPhFU0pkBYw+pf4vuU6qxN1T/eZNqkuA= X-Received: by 2002:a1f:7309:0:b0:494:63f7:4e7f with SMTP id o9-20020a1f7309000000b0049463f74e7fmr6799213vkc.2.1698208470086; Tue, 24 Oct 2023 21:34:30 -0700 (PDT) MIME-Version: 1.0 References: <44e32b0e-0e41-4055-bdb9-15bc7d47197c@intel.com> In-Reply-To: From: Barry Song <21cnbao@gmail.com> Date: Wed, 25 Oct 2023 12:34:17 +0800 Message-ID: Subject: Re: [PATCH] arm64: mm: drop tlb flush operation when clearing the access bit To: "Yin, Fengwei" Cc: Baolin Wang , catalin.marinas@arm.com, will@kernel.org, akpm@linux-foundation.org, v-songbaohua@oppo.com, yuzhao@google.com, linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Tue, 24 Oct 2023 21:34:36 -0700 (PDT) On Wed, Oct 25, 2023 at 11:09=E2=80=AFAM Yin, Fengwei wrote: > > > > On 10/25/2023 11:03 AM, Baolin Wang wrote: > >> > >> My understanding is that arm64 doesn't do invalidate the TLB during > = context switch. The flush_tlb_page_nosync() here + DSB during context > > > > Yes, we only perform a TLB flush when the ASID is exhausted during cont= ext switch, and I think this is same with x86 IIUC. > If we remove flush_tlb_page_nosync(), can we still claim TLB is flushed d= uring > context switch for ARM64? No. in this case, we will have to depend on hardware replacement of TLB on other CPUs. Considering LRU's list is really long and TLB is really small, a hot page needs a long time to move-back to inactive tail, other CPUs' TLB is likely to be replaced somewhere. But we do have a very small chance other CPUs will lose setting access flags in some corner cases. now i have more understanding why this nosync tlb flush is still there though in practical, removing it seems not to hurt. > > > > >> switch make sure the TLB is invalidated during context switch. > >> So we can't remove flush_tlb_page_nosync() here? Or something was chan= ged > >> for arm64 (I have zero knowledge to TLB on arm64. So some obvious thin= g > >> may be missed)? Thanks. > > > > IMHO, the tlb can be easily evicted or flushed if the system is under m= emory pressure, so like Barry said, the chance of reclaiming hot page is re= latively low, at least on X86, we did not see any heavy refault issue. > > > > For MGLRU, it uses ptep_test_and_clear_young() instead of ptep_clear_fl= ush_young_notify(), and we did not find any problems until now since deploy= ing to ARM servers. Thanks Barry