Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4683531iob; Sun, 8 May 2022 21:53:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZsm25sqG6q/2YWbptCZbQIWJYAuYgB4leg40Oukan7fGnbYRz2+cqRkmz0KJ7q7M/rFyW X-Received: by 2002:a17:903:11d0:b0:156:6c35:9588 with SMTP id q16-20020a17090311d000b001566c359588mr14545721plh.50.1652072027534; Sun, 08 May 2022 21:53:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652072027; cv=none; d=google.com; s=arc-20160816; b=j/2AWO6afGtBVXEtBmyX06fcvHwJRotoAYgqlNYij4CMAnqLIGVqcDuiHMIGPqdBzQ PjFu51c7PN7po9Z+6FvXaWtwr88iuqYOxmH/B4joLM2TMRw0TrKtXvdj1nvwknB8jkkb NXot95Ug338A33jGYqmyZVjSNFkzmdzdJiziYunaa266iOZG11vOgoFo148rCostg41p 3usjkg0Kat8Qreo580Y2a1G3y/X1tQnkczrDWwaTNN4G2TRTfhLXknBxxOP7Mp8QHXkp PGtjD3AhOqKFDxLSAzNLEVT7Vmlo5LcavcTCqNF+x6qAmQaQwf6K/wJc8NSMkpDE0yJm 8/nw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=4bztzCmwlVS2QcT4CrwLAm2LJYy0mvP8yzB7o5GzUlE=; b=SGGiWC/2uJTEZM5NoRIVHjUnehJp2XjK0hfMZucoNwTbsIEwkvVa9DyQN/P/pOgKmB DrwR7HuP1VS3zgyqzeIia4Lxl+WcLwY7zZ6EGZ5KE0bRkM7CAFO84oFiDURlAqeoyaFC lcgMXkkXwg68NqW63imK5zqpCYkwmv0WReIokylr9j3eFw7vBYRTC5wn3/n2X5dYOtYs z7H+QaoHGj3kZEPIqDlJ3rIFtaJ24/6JUwlzY7er66lRla506dgs7cXA5gHftkWPf6Iz ayNPMcAjshhoZXljlhQq9ocsOgEQqKHau2fCMs5aDEO8BkA/CV9/7I+t14A36yBDGxRB 1qKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VAwbnBGT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id u14-20020a056a00124e00b0050ad17f63c1si13963975pfi.251.2022.05.08.21.53.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 21:53:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=VAwbnBGT; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 863BCA1446; Sun, 8 May 2022 21:53:37 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236024AbiEEGjH (ORCPT + 99 others); Thu, 5 May 2022 02:39:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50616 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbiEEGjF (ORCPT ); Thu, 5 May 2022 02:39:05 -0400 Received: from mail-vs1-xe2d.google.com (mail-vs1-xe2d.google.com [IPv6:2607:f8b0:4864:20::e2d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9438EFD17 for ; Wed, 4 May 2022 23:35:26 -0700 (PDT) Received: by mail-vs1-xe2d.google.com with SMTP id x8so3301778vsg.11 for ; Wed, 04 May 2022 23:35:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=4bztzCmwlVS2QcT4CrwLAm2LJYy0mvP8yzB7o5GzUlE=; b=VAwbnBGTaJd6CJdGKIY38ODe/I0OSZG3i+j+HGdcVT0DkKaZqnFssiWzfzn+ARvpQu dvaH2jDGTkpqey5QsaZ89a3EGLC+YJSCRuyxJ1EuSnmgWMQ4I3Yd8uQsGh8YmzTeJSGv LWLbrwZIxlxVtZNLES/wezGhRQHZrvUcTuD1K1eS5Z3rE0RoB92Fm5/4FntJaUMND2GZ kyk8uzMJJ4kKfGoZmY9fVXY4HSPfWn7xVjX9cKGPKImthjYk9qrybX8HYuiGW/wVyvp/ FPazVDw3DE3/oSqqLHe02RbelyDOpBN3DVCVkUtSw16cC08mfEx3KPlxVMONUeA4+vUJ Qp5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=4bztzCmwlVS2QcT4CrwLAm2LJYy0mvP8yzB7o5GzUlE=; b=bIpwbl1fnKjz9AJHqDomxAaYggOkd+NnmLRlw09MIIar6uw4Wx5EgoPOkPcImQnWZm S3rmQtKn9BczAjyNwEnCNYctVfrwUNl1Lb1JSTbPDNu/ouYe+0ZFCoo0hO47REC8nBOi xepQ6mrIVJmUL1dZbYSJl66ixDIfJ5mUBl69XOKOu6HsMEvsn7tE/cVNx18wVguru7eT mu6ItKaY1QFeG8lHaNHlOCIxUbCp98kTS159ckrJi9lzxU73GXfhmPslscwYQswlYNxO fhPn1lnRyRbrMRfNAPN1vD4YM13pQrddmsHX0Y0J2nMz5oLMCjhz6KpmySYpXUQVYIhT SJgw== X-Gm-Message-State: AOAM530NFOyStMnUF7Zm3EhBKIjFNN9chkWkiNIRPaI/iLVjw3mrWZLO xIC9faHbD55x9T0YYuVeuTh0UpijUfsBj2g8ktUnaA== X-Received: by 2002:a67:2fc6:0:b0:32d:7195:32e9 with SMTP id v189-20020a672fc6000000b0032d719532e9mr1741557vsv.44.1651732525536; Wed, 04 May 2022 23:35:25 -0700 (PDT) MIME-Version: 1.0 References: <20220501175813.tvytoosygtqlh3nn@offworld> <87o80eh65f.fsf@nvdebian.thelocal> <87mtfygoxs.fsf@nvdebian.thelocal> <9fb22767-54de-d316-7e6b-5aac375c9c49@intel.com> <52541497-c097-5a51-4718-feed13660255@intel.com> In-Reply-To: <52541497-c097-5a51-4718-feed13660255@intel.com> From: Wei Xu Date: Wed, 4 May 2022 23:35:14 -0700 Message-ID: Subject: Re: RFC: Memory Tiering Kernel Interfaces To: Dave Hansen Cc: Alistair Popple , Davidlohr Bueso , Andrew Morton , Dave Hansen , Huang Ying , Dan Williams , Yang Shi , Linux MM , Greg Thelen , "Aneesh Kumar K.V" , Jagdish Gediya , Linux Kernel Mailing List , Michal Hocko , Baolin Wang , Brice Goglin , Feng Tang , Jonathan Cameron Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL autolearn=no 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 On Wed, May 4, 2022 at 10:02 AM Dave Hansen wrote: > > On 5/3/22 18:31, Wei Xu wrote: > >> Well, x86 CPUs have performance monitoring hardware that can > >> theoretically collect physical access information too. But, this > >> performance monitoring hardware wasn't designed for this specific use > >> case in mind. So, in practice, these events (PEBS) weren't very useful > >> for driving memory tiering. > > The PEBS events without any filtering might not be useful for memory > > tiering, but the PEBS events with hardware-based data source filtering > > can be useful in driving promotions in memory tiering. Certainly, > > because these events are not designed for this specific use case in > > mind, there are inefficiencies using them for memory tiering, e.g. > > instead of just getting a heat counter for each hot page, we can get > > events repeatedly on the hot pages. > > Also, I believe the addresses that come out of the PEBS events are > virtual addresses (Data Linear Addresses according to the SDM). If the > events are written from a KVM guest, you get guest linear addresses. > > That means a lot of page table and EPT walks to map those linear > addresses back to physical. That adds to the inefficiency. That's true if the tracking is purely based on physical pages. For hot page tracking from PEBS, we can consider tracking in virtual/linear addresses. We don't need to maintain the history for all linear page addresses nor for an indefinite amount of time. After all, we just need to identify pages accessed frequently recently and promote them. > In the end, you get big PEBS buffers with lots of irrelevant data that > needs significant post-processing to make sense of it. I am curious about what are "lots of irrelevant data" if PEBS data is filtered on data sources (e.g. DRAM vs PMEM) by hardware. If we need to have different policies for the pages from the same data source, then I agree that the software has to do a lot of filtering work. > The folks at Intel that tried this really struggled to take this mess and turn it into a successful hot-page tracking. > > Maybe someone else will find a better way to do it, but we tried and > gave up. It might be challenging to use PEBS as the only and universal hot page tracking hardware mechanism. For example, there are challenges to use PEBS to sample KVM guest accesses from the host. On the other hand, PEBS with hardware-based data source filtering can be a useful mechanism to improve hot page tracking in conjunction with other techniques.