From mboxrd@z Thu Jan 1 00:00:00 1970 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="w0+ZgNTP" 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-Google-Smtp-Source: AGHT+IErfD3/6U7Yg0vFWmN+JznLDOE9vgR2lO1JhTGk52Ll6iOJE5uAx2O1dqENYjCcQTLMPcB8oRdC9wY= 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?