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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9F20DC3DA7F for ; Mon, 5 Aug 2024 16:55:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: Content-Type:Cc:To:Subject:Message-ID:Date:From:In-Reply-To:References: MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=w+EjPosfkeXziba69Qb6GXWNK9P7pF1IIw+Hux9jBR8=; b=PuD8CiSxaQDgVbCtuzwTRYfmAj nHZaLq9/uohPWTQNqr7x0SBkQ2em+PI1YEZmajpY9Cxa0w//9ztQxpEmc1pV1ITBOrsjzusoJYkcz 53JDB7SEdO8TK3UnYUPfHfjfs7vBKFHPKU1p6iTW7gGkQdfJ10PccJlPOD4ZmdxLDXLmMABQ94DmQ aDpHoCWeKrMyB8MYxmbww5Kiow/qBg0j9n85S/jYFu7ppQGxxS+0hPLkfu+mvIckMjh3xw9daFIlD xDXSTOd+BP2NwGzTZINkBw5BG2rSvN3Cvco8oRGmpIVyYzXmqYtWfznBRq2xolDE36unQWcOb/Hvl iG392M3g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sb0zV-0000000GaYB-2pN3; Mon, 05 Aug 2024 16:55:25 +0000 Received: from mail-qt1-x82a.google.com ([2607:f8b0:4864:20::82a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sb0yy-0000000GaNE-0Cv9 for linux-arm-kernel@lists.infradead.org; Mon, 05 Aug 2024 16:54:54 +0000 Received: by mail-qt1-x82a.google.com with SMTP id d75a77b69052e-45029af1408so4131cf.1 for ; Mon, 05 Aug 2024 09:54:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1722876888; x=1723481688; darn=lists.infradead.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=w+EjPosfkeXziba69Qb6GXWNK9P7pF1IIw+Hux9jBR8=; b=VZFJqEpzqTW4tmDscl885rnkd/AzAt9Jm69dLy+B5jPix8Wl3lbtYoPULKyb5Uq71N ZeXGczKCVSZmrI5ihi+KykyhE3HFyG+fTjvKNPK39+DFJh0YBejnIgMLgjnkp8+OCyla NyNaOkzMqLOmWY3aunWBiKr2Uc2wfqMunMQQAvHMl0quwOEu0SGSdppUXooAjU3oW09j /yPT8Iz8H6zdFps+363QHPcwGMWLDsG6FoVQfYxjWstodcQy1i909OJg9ej4xwI+IBFJ dOAAw/RydQMmhPNv2Jbvp2SU0p9tHGDgNuAY/DlIofpoqpo7YuhnsgegcajTRH/GDt6x 9Zxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722876888; x=1723481688; 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=w+EjPosfkeXziba69Qb6GXWNK9P7pF1IIw+Hux9jBR8=; b=UWwPAIh/bLj56bENRwk4oA6Zcv7lxwzFsSQlOKz+61JZ4wjMzvauyjjOqc28ZemuO/ 26Wx0v2WkBxjlWeU9nUy72nA9IH43lnH8rWXh5ECX5PWo2R4HeDj3S02XBb1ydTqIDbO oeq/fBXv6a13oONmwElBz3cg0kfT78O9NO/s9rcnLr+8dsh34g/2Wd6YQIby/fCrW1hM tBfAJyHwzsXfTQ9c2A0FLBjLck6C4uXrRXN2ZKGJ2fk52VtatnCwMnIP/wcIWUlIRCd+ BFaWLVboqfNqZP4YWXJrfR/uwQ4+MsYKlJD1Nq7f8H7FGmwjXh/lzSfzll4AHJ+QAOM4 mqoQ== X-Forwarded-Encrypted: i=1; AJvYcCUymumup7v4iZs8RtH3gW6XAFU7bZx35cXcRFUifE8327LzHExwHYPzZ2GQAEHBpljhzdI6mIFOdw+08OQZDrZaG5kzfK5cl7X+Y51q873o5xMG+98= X-Gm-Message-State: AOJu0YzRW56goNFmPOPaXMYdqmCFezsiyiXiHhuAi2meUwpkrpbXyte0 sSNTQ0hN24NDlNjj8/ECCCXlhjQzE37j8gcEZcAnwEnM7fo7hZCQwKN+i/x6eiqtjYQavlW2F3L CLGwu6Q1v/bEXkBsQCNuIbmDp+cb+PaFe+Gyn X-Google-Smtp-Source: AGHT+IEew9O40a1eagPinVnKq66XRqxq93dCPlTyT+sju/BWCkpRZjCn//Ri9HlnLHZeIehCzQD5j6qeXg1tqDmASbI= X-Received: by 2002:a05:622a:301:b0:44f:cb30:8b71 with SMTP id d75a77b69052e-4519b663469mr5193091cf.25.1722876887583; Mon, 05 Aug 2024 09:54:47 -0700 (PDT) MIME-Version: 1.0 References: <20240724011037.3671523-1-jthoughton@google.com> <20240724011037.3671523-6-jthoughton@google.com> <37ae59f2-777a-4a58-ae58-4a20066364dd@redhat.com> <1ea7a0d2-e640-4549-ac0e-8ae0df8d8e6a@redhat.com> In-Reply-To: <1ea7a0d2-e640-4549-ac0e-8ae0df8d8e6a@redhat.com> From: James Houghton Date: Mon, 5 Aug 2024 09:54:10 -0700 Message-ID: Subject: Re: [PATCH v6 05/11] mm: Add fast_only bool to test_young and clear_young MMU notifiers To: David Hildenbrand Cc: Andrew Morton , Paolo Bonzini , Ankit Agrawal , Axel Rasmussen , Catalin Marinas , David Matlack , David Rientjes , James Morse , Jason Gunthorpe , Jonathan Corbet , Marc Zyngier , Oliver Upton , Raghavendra Rao Ananta , Ryan Roberts , Sean Christopherson , Shaoqin Huang , Suzuki K Poulose , Wei Xu , Will Deacon , Yu Zhao , Zenghui Yu , kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240805_095452_113684_9CAB61BB X-CRM114-Status: GOOD ( 32.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Fri, Aug 2, 2024 at 8:57=E2=80=AFAM David Hildenbrand = wrote: > > On 02.08.24 01:13, James Houghton wrote: > > On Thu, Aug 1, 2024 at 2:36=E2=80=AFAM David Hildenbrand wrote: > >> > >> On 24.07.24 03:10, James Houghton wrote: > >>> For implementers, the fast_only bool indicates that the age informati= on > >>> needs to be harvested such that we do not slow down other MMU operati= ons, > >>> and ideally that we are not ourselves slowed down by other MMU > >>> operations. Usually this means that the implementation should be > >>> lockless. > >> > >> But what are the semantics if "fast_only" cannot be achieved by the > >> implementer? > >> > >> Can we add some documentation to the new functions that explain what > >> this mysterious "fast_only" is and what the expected semantics are? > >> Please? :) > > > > Thanks for pointing out the missing documentation. How's this? > > > > diff --git a/include/linux/mmu_notifier.h b/include/linux/mmu_notifier.= h > > index 45c5995ebd84..c21992036dd3 100644 > > --- a/include/linux/mmu_notifier.h > > +++ b/include/linux/mmu_notifier.h > > @@ -106,6 +106,18 @@ struct mmu_notifier_ops { > > * clear_young is a lightweight version of clear_flush_young. = Like the > > * latter, it is supposed to test-and-clear the young/accessed= bitflag > > * in the secondary pte, but it may omit flushing the secondar= y tlb. > > + * > > Probably makes sense to highlight the parameters like @fast_only Will do. > > > + * The fast_only parameter indicates that this call should not = block, > > + * and this function should not cause other MMU notifier calls = to > > + * block. Usually this means that the implementation should be > > + * lockless. > > + * > > + * When called with fast_only, this notifier will be a no-op un= less > > + * has_fast_aging is set on the struct mmu_notifier. > > "... and will return 0 (NOT young)." ? Thanks, I'll add this. > > > + * > > + * When fast_only is true, if the implementer cannot determine = that a > > + * range is young without blocking, it should return 0 (i.e., > > + * that the range is NOT young). > > */ > > int (*clear_young)(struct mmu_notifier *subscription, > > struct mm_struct *mm, > > @@ -118,6 +130,8 @@ struct mmu_notifier_ops { > > * the secondary pte. This is used to know if the page is > > * frequently used without actually clearing the flag or teari= ng > > * down the secondary mapping on the page. > > + * > > + * The fast_only parameter has the same meaning as with clear_y= oung. > > */ > > int (*test_young)(struct mmu_notifier *subscription, > > struct mm_struct *mm, > > > > I've also moved the commit that follows this one (the one that adds > > has_fast_aging) to be before this one so that the comment makes sense. > > > Makes sense, thanks! Thanks David!