From patchwork Wed Jan 26 17:00:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonghyeon Kim X-Patchwork-Id: 12725490 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B7B19C63682 for ; Wed, 26 Jan 2022 17:01:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5128C6B0071; Wed, 26 Jan 2022 12:01:05 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4C2C26B0074; Wed, 26 Jan 2022 12:01:05 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 38A816B0075; Wed, 26 Jan 2022 12:01:05 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id 29B546B0071 for ; Wed, 26 Jan 2022 12:01:05 -0500 (EST) Received: from smtpin29.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id DBCE6181CB145 for ; Wed, 26 Jan 2022 17:01:04 +0000 (UTC) X-FDA: 79073053248.29.0F41729 Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by imf25.hostedemail.com (Postfix) with ESMTP id 8A4AAA0088 for ; Wed, 26 Jan 2022 17:00:42 +0000 (UTC) Received: by mail-pf1-f178.google.com with SMTP id y27so305173pfa.0 for ; Wed, 26 Jan 2022 09:00:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ajou.ac.kr; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Onl1JpmjZEa6zJu2g35kLpJMmMBIoxN/vI9o07uZnSE=; b=vG81hp3GKcDmDaHOEl5NZqjWXqgKUrX8vpZ4U+RfzlWC0F5JUgHlxzbXhrzgfjS//A HUeiYP+XaNjRlzyClU0pNEVdAgc/UC/0hICDjqLbIw8LfYGJ4jUW+PffSJFnRHLctw6A 0V627+CXnH7SJVSr2BOcS8aAGbFY3INNRdSF0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Onl1JpmjZEa6zJu2g35kLpJMmMBIoxN/vI9o07uZnSE=; b=K0ul17cA/w7eG5ReG7PNIRJWqVS+FZuY+Gq8vi7+725nrNQF8XY3OBTYUcjUzTumLv q9TjDB/u8wZqgk56Dsm95EIhrjfwx0tpBGsEfCcoq+0DjnIsFMay4Qz8rwzMStuXaiOd Xt2ht8a95SfYzuKX0x/FYdk6JTkKNJSmd4+APFznku7MMAoY+IXstZewbqUpin6Zmph1 o03Ey0cFqZOCdRcmx7QsBxi9FPn7srJ9Iq8NLaOZcDOHmA29vs0hj3pLCFXkRgvewD/t AF5LKpR7Yb9tDCdmTT0kN2PJre2/cOCpB2DjeE8OKqEM279opdt5v7CK3UGBoKTH9OW0 xZAw== X-Gm-Message-State: AOAM5329RyRs3eHnkCcu4Jpd5pFeIiYmSmarROaPzxjzYf70snpB3joy 9PDiqbg6BbMfaOe72sHOaTOGda3aOMMhFwZYKMg= X-Google-Smtp-Source: ABdhPJzhTWxkvUgBtwM91u+cYKbIdx3dFiNFTCB+D62IGdpTAENUFNPgH4+d0xS7tt+MSUEXK5AAeQ== X-Received: by 2002:aa7:9009:0:b0:4c6:fe2f:6a94 with SMTP id m9-20020aa79009000000b004c6fe2f6a94mr11307661pfo.25.1643216441424; Wed, 26 Jan 2022 09:00:41 -0800 (PST) Received: from localhost.localdomain ([210.107.197.32]) by smtp.googlemail.com with ESMTPSA id q6sm17540644pgb.85.2022.01.26.09.00.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Jan 2022 09:00:41 -0800 (PST) From: Jonghyeon Kim To: dan.j.williams@intel.com Cc: vishal.l.verma@intel.com, dave.jiang@intel.com, akpm@linux-foundation.org, nvdimm@lists.linux.dev, linux-kernel@vger.kernel.org, linux-mm@kvack.org, Jonghyeon Kim Subject: [PATCH 2/2] dax/kmem: Update spanned page stat of origin device node Date: Thu, 27 Jan 2022 02:00:02 +0900 Message-Id: <20220126170002.19754-2-tome01@ajou.ac.kr> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220126170002.19754-1-tome01@ajou.ac.kr> References: <20220126170002.19754-1-tome01@ajou.ac.kr> X-Rspam-User: nil X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 8A4AAA0088 X-Stat-Signature: t8jx1yxhj7b73xg1t97btgetknftw56z Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=ajou.ac.kr header.s=google header.b=vG81hp3G; dmarc=pass (policy=reject) header.from=ajou.ac.kr; spf=pass (imf25.hostedemail.com: domain of tome01@ajou.ac.kr designates 209.85.210.178 as permitted sender) smtp.mailfrom=tome01@ajou.ac.kr X-HE-Tag: 1643216442-744143 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001464, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: When device memory adds to the online NUMA node, the number of spanned pages of the original device NUMA node should be updated. By this patch, we can monitor the current spanned pages of each node more accurately. Signed-off-by: Jonghyeon Kim Reported-by: kernel test robot Reported-by: kernel test robot --- drivers/dax/kmem.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/dax/kmem.c b/drivers/dax/kmem.c index a37622060fff..f63a739ac790 100644 --- a/drivers/dax/kmem.c +++ b/drivers/dax/kmem.c @@ -11,6 +11,7 @@ #include #include #include +#include #include "dax-private.h" #include "bus.h" @@ -48,6 +49,7 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax) struct dax_kmem_data *data; int i, rc, mapped = 0; int numa_node; + int dev_node; /* * Ensure good NUMA information for the persistent memory. @@ -147,6 +149,18 @@ static int dev_dax_kmem_probe(struct dev_dax *dev_dax) dev_set_drvdata(dev, data); + /* Update spanned_pages of the device numa node */ + dev_node = dev_to_node(dev); + if (dev_node != numa_node && dev_node < numa_node) { + struct pglist_data *pgdat = NODE_DATA(dev_node); + struct zone *zone = &pgdat->node_zones[ZONE_DEVICE]; + unsigned long start_pfn = zone->zone_start_pfn; + unsigned long nr_pages = NODE_DATA(numa_node)->node_spanned_pages; + + shrink_zone_span(zone, start_pfn, start_pfn + nr_pages); + update_pgdat_span(pgdat); + } + return 0; err_request_mem: