Received: by 2002:a05:6a10:7420:0:0:0:0 with SMTP id hk32csp636427pxb; Wed, 16 Feb 2022 00:33:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJxDhotYfdFLStITS/eeaSCMBDc8yo0vIZfRJP2W5EcXwr5s2N/CxHUyEuFn4cUh0WqE8H4l X-Received: by 2002:a63:4d10:0:b0:36c:dcd6:46d7 with SMTP id a16-20020a634d10000000b0036cdcd646d7mr1374293pgb.207.1645000417304; Wed, 16 Feb 2022 00:33:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645000417; cv=none; d=google.com; s=arc-20160816; b=T8O67RNviXif2C+nFatLm7UP+IE/n9rHzuem3wApOjEr4TMI4OZCdNHYlY6L//ULUX LSM3NQx5nHVyo0cMgj0egj+1wJxMy6sBURksDSdu8GfXLM5xWm3T/34EdPnQ59gMcHsL 4t+2Wt6zJHc/MkSCcp1yhOT0ps4rJOXWqx3kh6F4iPMi8rLvZu0eR8LHc9+yaFVt3Fi1 zwJPOdFZOrxlO9qlOIRIDLjgIV9qr0FI1a86FjYzeUk/wiM76ZxupXShNAVZm+A1pHMB 3NiUZ0LG/lx8Rn53W60MQuZXP7E2ah9TB1NaIzMOrFk+NY2Txfx6VcO4u+UnwWfxVfQN Tdew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=G3A+GzBhgKNctuAUTGkhN5FLor9PogyWuipVfjQDOtg=; b=jYsPXBuUyTGvdumBr+ZsJZ2/UWVQkpLpNAp5y+w4ixfi0jfv60RnkKY7gn19RuJLCk QaYNPoDogJ0pU/ZFF1duLXPz6LjJMb9oerqR0NpAnY3mgo/W1Z/kC/iraMAYoypqHbaD eg0xWUpbGnMT7bbDwns654QRYjAmo8q1d166v0Chact5Cp4svYZ61P7IVssG4qeg+DvY U7JnUxhotEKSwgYTKNLOuovQ5Xhvho/QjLhfPXIu96P5X3emPp9F4IQrd/zQMJjxNw3v i2+3ggt3Cq5G2HrhvKFrrY5UDs/FU+MOqtsuEtdfYdlfascIoxXIpgv5T42Nn4Kq4dSG a1LQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id 65si18947154pff.216.2022.02.16.00.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Feb 2022 00:33:37 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E0ACE2A417C; Wed, 16 Feb 2022 00:30:52 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229511AbiBPIa7 (ORCPT + 99 others); Wed, 16 Feb 2022 03:30:59 -0500 Received: from gmail-smtp-in.l.google.com ([23.128.96.19]:34768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229436AbiBPIa6 (ORCPT ); Wed, 16 Feb 2022 03:30:58 -0500 Received: from out30-42.freemail.mail.aliyun.com (out30-42.freemail.mail.aliyun.com [115.124.30.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AF8C221E31 for ; Wed, 16 Feb 2022 00:30:46 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R191e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04426;MF=xhao@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0V4cXjy8_1645000243; Received: from localhost.localdomain(mailfrom:xhao@linux.alibaba.com fp:SMTPD_---0V4cXjy8_1645000243) by smtp.aliyun-inc.com(127.0.0.1); Wed, 16 Feb 2022 16:30:44 +0800 From: Xin Hao To: sj@kernel.org Cc: xhao@linux.alibaba.com, rongwei.wang@linux.alibaba.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [RFC PATCH V1 0/5] mm/damon: Add NUMA access statistics function support Date: Wed, 16 Feb 2022 16:30:36 +0800 Message-Id: X-Mailer: git-send-email 2.31.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY 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 today's cloud computing service scenario, NUMA (non uniform memory access) architecture server has been applied on a large scale. Using Damon function, it can easily and lightweight identify hot and cold memory, but it can not display the situation of locale and remote NUMA memory access. The purpose of these serie patches is to identify the situation of NUMA access in combination with DAMON, especially for remote NUMA access in hot memory. We hope to detect this situation in the data center and use page migration or multi backup page technology to optimize the behavior of memory access. So next, we will further improve Damon NUMA function: 1. Support hugtlbfs NUMA access statistics. 2. Add the DAMO tool to parse NUMA local & remote in "damon_region" support. 3. For hot memory remote NUMA access, support page migration or multi backup page. About DAMON correctness of numa access statistics We wrote a test case, allocate about 1G memory, and use numa_alloc(), set 512M in NUMA node0 and 512M in NUMA node1, and The test case alternately accesses the 1G of memory. We used "perf record -e damon:damon_aggregated" and "perf script" cmd to obtain data, like this: kdamond.0 target_id=0 nr_regions=10 281473056325632-281473127964672:: 12 0 5243 5513 kdamond.0 target_id=0 nr_regions=10 281473127964672-281473238028288: 8 1 5427 5399 ... kdamond.0 target_id=0 nr_regions=10 281473056325632-281473127964672: 9 3 7669 7632 kdamond.0 target_id=0 nr_regions=10 281473127964672-281473238028288: 7 2 7913 7892 And compared with numastat like this: Per-node process memory usage (in MBs) for PID 111676 (lt-numademo) Node 0 Node 1 Node 2 --------------- --------------- --------------- Huge 0.00 0.00 0.00 Heap 0.02 0.00 0.00 Stack 0.01 0.00 0.00 Private 565.24 564.00 0.00 ---------------- --------------- --------------- --------------- Total 565.27 564.00 0.00 This comparison can determine the accuracy of Damon NUMA memory access statistics. About the impact of DAMON NUMA access on Performance During the benchmakr test, we found that the MBW benchmark memcpy test item will cause about 3% performance degradation, and there is no performance degradation in other benchmarks. So we added "numa_stat" switch in DAMON dbgfs interface, turn on this switch when NUMA access statistics is required. Xin Hao (5): mm/damon: Add NUMA local and remote variables in 'damon_region' mm/damon: Add 'damon_region' NUMA fault simulation support mm/damon: Add 'damon_region' NUMA access statistics core implementation mm/damon/dbgfs: Add numa simulate switch mm/damon/tracepoint: Add 'damon_region' NUMA access statistics support include/linux/damon.h | 25 ++++++++++ include/trace/events/damon.h | 9 +++- mm/damon/core.c | 94 +++++++++++++++++++++++++++++++++++- mm/damon/dbgfs.c | 70 ++++++++++++++++++++++++--- mm/damon/paddr.c | 25 ++++++++-- mm/damon/prmtv-common.c | 44 +++++++++++++++++ mm/damon/prmtv-common.h | 3 ++ mm/damon/vaddr.c | 45 ++++++++++------- mm/huge_memory.c | 5 ++ mm/memory.c | 5 ++ 10 files changed, 292 insertions(+), 33 deletions(-) -- 2.27.0