Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp920187lqb; Wed, 29 May 2024 15:00:15 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX1fZkze5rLSWVs0IuBiSQTMjPXynMsCGUQ0ZoXSabXRB7+LjFMQx1YyhWy6hq0UYPO69SAJRJ+YT4Y3JKr/BazDurVg8NiulvcH6RDyw== X-Google-Smtp-Source: AGHT+IF23qPnwnV8/Fdx7sO3j0W5+mtDy0sC8QWEz+Ihj6PqSOSxHwEW9gSC7z20qZhQL+4hU1D4 X-Received: by 2002:a17:90a:fb8f:b0:2bd:f1d5:8e3f with SMTP id 98e67ed59e1d1-2c1abc4e470mr348887a91.41.1717020014979; Wed, 29 May 2024 15:00:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717020014; cv=pass; d=google.com; s=arc-20160816; b=XoZo6xMhOl7NzZb379X0AZVX87O1hwX0/w1Cv12AKgwdf1fbQ6lziG6C/d1GVDpC6u TWNEu74uwQhgerquEi7JmEhhKCyzl8sSxVyjMuFTuM9h1xV7MGJs580TupehiMQy6XMV zG/Ab2wls6MPHQwq3TAdRFKiHs+fzjgwpwViw0rfrYttyD8AL0hQCfeJ/w9tkMbgZnvT FbF+9S47h8Uso8ZyTdZHLagzy+AO3lz72tZmblPGzWUZant4CIlsNMO3wYrk0S+Rcy9Z CBp2Evbbanbh9batkrIHboXNYWzKCpi8Fv4UwUJFsw/x4h6OcBk/fDz7IV9a/Ge5NjG9 Xwwg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :in-reply-to:date:dkim-signature; bh=VygQSYtgJkxGCNbSiB1TmlrjiVcPo9FASZn5iwrGyKo=; fh=ybIL8UpMUZqW075CHO4C6soY+EmdcYLBwEXVi/xgsaM=; b=KXi1WH2T6p+v3c8XCeUM+NhoVnGnO8SCir1BFOQNBKscdf6udy56vcQDFgv+pvCG+G esDJv0c3KwhEM933OZOBnOOJspucg7mheprNmOJDL0NEsn9lAEXk2aWCa23Od/ZRhfpg fakUO/ANA6c1zoxZxqKkt9TSV2iJCwihQrFGIadv20n+cCy5rnDdBXEy0RigQpgZ3aC5 EMiTB/nCeSdjERB+NY4qNrCyBSrg02/rijysyKEWj61nWEK1ncpbTyEa8WzmmHGnXU7f H/UehMII6gKHO9XF/qWAzIUwVr2JTri+jb2Q84ctb0t6rtF91KMHimty/jgxnqYF1JWg AwfA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=w0+ZgNTP; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-194717-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194717-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2c1a77d9a1esi346970a91.187.2024.05.29.15.00.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 15:00:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194717-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=w0+ZgNTP; arc=pass (i=1 spf=pass spfdomain=flex--seanjc.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-194717-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194717-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 96E37B23055 for ; Wed, 29 May 2024 22:00:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 71F081C9EDF; Wed, 29 May 2024 22:00:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="w0+ZgNTP" Received: from mail-pf1-f202.google.com (mail-pf1-f202.google.com [209.85.210.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 42B8B1C9EBA for ; Wed, 29 May 2024 21:59:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717019999; cv=none; b=S12ofd7ujKVGUhZF1Hzl1MuSHBPsaQpp16YAQOJvhwkFNnb3J7kyV4qyWpnvNqPjJ62rgutClYWrqMs+uZ0sQYyYHaFySK6sttpMq2KVoFRk51G7UEV2FbywcDFSW0l24hmzNJo41ILyJEQ7S0+y7/yK6fu+1Yh1N6zgLQwKU0c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717019999; c=relaxed/simple; bh=VygQSYtgJkxGCNbSiB1TmlrjiVcPo9FASZn5iwrGyKo=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=XmulC1OppKJsjE7neqWbiKGLT8K1zgFSG6gQHmuLUtbZ6rxHRVozUcNurLXyM8MeQIY1ELoPkCNg/VXJwnFcUGMoI8asCXj4t7OdS1ev7lsLsQzoqRN4s6KjyWvfZy7BQFFzJS2PX2EIoLbM0/uZwDNkwW5Z9jo0eFKlLbyOD7Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=w0+ZgNTP; arc=none smtp.client-ip=209.85.210.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Received: by mail-pf1-f202.google.com with SMTP id d2e1a72fcca58-6fb22ecd976so146541b3a.1 for ; Wed, 29 May 2024 14:59:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1717019997; x=1717624797; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:from:to:cc:subject:date:message-id :reply-to; bh=VygQSYtgJkxGCNbSiB1TmlrjiVcPo9FASZn5iwrGyKo=; b=w0+ZgNTPQb9aX0poHvtDZZm3p4fR7g6y3BVn38ULDgIF+EmfrNCDJoZ13Y8UVFQzSv ZgxhWa+OCPlMPluvNLQOmLNOpf0ub1w6SQ9We5NrhY81fiU39R+ao5v2my1gqzr6nDp3 9/Qh9tLRT+1lmz1zmtwnJ8QY4gZWd8JwxPHdQBPSUpYXOrKJlCrFNSvDiBQMH5r7D1Yt 2rg8dDI0c2aupjqnlC0vKxC8L0D4+O6KWvhVYb1HavK3VfsdxNo5duPaaaYoWzrVvmRQ AoEjFqsR/ASHBJm3nuRdUknt8abriWdhUWXfKv+DNrIuBVJLiBZutYH59fEM8t7P6zD9 veig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717019997; x=1717624797; h=content-transfer-encoding:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=VygQSYtgJkxGCNbSiB1TmlrjiVcPo9FASZn5iwrGyKo=; b=armD7/Hz1AeOJiWSMKYufhhNb3rPbZKScORWu1xt+lJDKGXtAx6FVXsixUz/zWjv1S oTXu3LlEpfFHqwgVDL5VhWSK791A9LlMpjT3T1JUKT3MjW0hbhCRDfuhpr9NqQbot5ed +uM7hHOICvd/7tPg3NUUYrbssBW+gySd7uThRAkU/4ibxr9xbuglpZgaoOiIigWFLIdN ZRvomnhsZraejZ0BUdLjFHP6QfOkSHmWDtPc1NWWj6zSKZG88MjPHF4IarzEkt308K+J m+jfhF2HDO0hyM8nQlAZKwCMFfuYFBRchR57iHyc0oFSLgoc3S93oP8CgTW4OWtk87Je F1nw== X-Forwarded-Encrypted: i=1; AJvYcCWKxbIYIjPVz+8TBtXAlDHz9ZVc2gh/8h/zz5Dtf0kS6N1LsnHKq4Tn9BAgFF1BD+bYlhpFYG621aEfmxbG820eW95F2nmrxdEE0Bqh X-Gm-Message-State: AOJu0YwLtHWMkbwqjLXRboO8oNqR9DjJfRlf0rhhyZcq/8/yMo3o5ZY5 44IwSGtXAPbZSw+c/DlId+MCsinBxGdrBqm5vSgaiUCqergclJ+DrsTdoVB3IJbMyclNMHgBZWu iUA== X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6a00:8607:b0:702:1e25:a47c with SMTP id d2e1a72fcca58-70231a8676amr343b3a.1.1717019996755; Wed, 29 May 2024 14:59:56 -0700 (PDT) Date: Wed, 29 May 2024 14:59:55 -0700 In-Reply-To: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20240529180510.2295118-1-jthoughton@google.com> <20240529180510.2295118-3-jthoughton@google.com> Message-ID: Subject: Re: [PATCH v4 2/7] mm: multi-gen LRU: Have secondary MMUs participate in aging From: Sean Christopherson To: Yu Zhao Cc: James Houghton , Andrew Morton , Paolo Bonzini , Albert Ou , Ankit Agrawal , Anup Patel , Atish Patra , Axel Rasmussen , Bibo Mao , Catalin Marinas , David Matlack , David Rientjes , Huacai Chen , James Morse , Jonathan Corbet , Marc Zyngier , Michael Ellerman , Nicholas Piggin , Oliver Upton , Palmer Dabbelt , Paul Walmsley , Raghavendra Rao Ananta , Ryan Roberts , Shaoqin Huang , Shuah Khan , Suzuki K Poulose , Tianrui Zhao , Will Deacon , Zenghui Yu , kvm-riscv@lists.infradead.org, kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable On Wed, May 29, 2024, Yu Zhao wrote: > On Wed, May 29, 2024 at 12:05=E2=80=AFPM James Houghton wrote: > > > > Secondary MMUs are currently consulted for access/age information at > > eviction time, but before then, we don't get accurate age information. > > That is, pages that are mostly accessed through a secondary MMU (like > > guest memory, used by KVM) will always just proceed down to the oldest > > generation, and then at eviction time, if KVM reports the page to be > > young, the page will be activated/promoted back to the youngest > > generation. >=20 > Correct, and as I explained offline, this is the only reasonable > behavior if we can't locklessly walk secondary MMUs. >=20 > Just for the record, the (crude) analogy I used was: > Imagine a large room with many bills ($1, $5, $10, ...) on the floor, > but you are only allowed to pick up 10 of them (and put them in your > pocket). A smart move would be to survey the room *first and then* > pick up the largest ones. But if you are carrying a 500 lbs backpack, > you would just want to pick up whichever that's in front of you rather > than walk the entire room. >=20 > MGLRU should only scan (or lookaround) secondary MMUs if it can be > done lockless. Otherwise, it should just fall back to the existing > approach, which existed in previous versions but is removed in this > version. IIUC, by "existing approach" you mean completely ignore secondary MMUs that= don't implement a lockless walk?