linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Jiaqi Yan <jiaqiyan@google.com>
Cc: tony.luck@intel.com, naoya.horiguchi@nec.com, duenwen@google.com,
	rientjes@google.com, linux-mm@kvack.org, shy828301@gmail.com,
	wangkefeng.wang@huawei.com
Subject: Re: [PATCH v1 2/3] mm: memory-failure: Bump memory failure stats to pglist_data
Date: Mon, 16 Jan 2023 12:16:13 -0800	[thread overview]
Message-ID: <20230116121613.234145e82988ca3e602dfce5@linux-foundation.org> (raw)
In-Reply-To: <20230116193902.1315236-3-jiaqiyan@google.com>

On Mon, 16 Jan 2023 19:39:01 +0000 Jiaqi Yan <jiaqiyan@google.com> wrote:

> Right before memory_failure finishes its handling, accumulate poisoned
> page's resolution counters to pglist_data's memory_failure_stats, so as
> to update the corresponding sysfs entries.
> 
> Tested:
> 1) Start an application to allocate memory buffer chunks
> 2) Convert random memory buffer addresses to physical addresses
> 3) Inject memory errors using EINJ at chosen physical addresses
> 4) Access poisoned memory buffer and recover from SIGBUS
> 5) Check counter values under
>    /sys/devices/system/node/node*/memory_failure/pages_*
> 
> --- a/mm/memory-failure.c
> +++ b/mm/memory-failure.c
> @@ -1227,6 +1227,39 @@ static struct page_state error_states[] = {
>  #undef slab
>  #undef reserved
>  
> +static void update_per_node_mf_stats(unsigned long pfn,
> +				     enum mf_result result)
> +{
> +	int nid = MAX_NUMNODES;
> +	struct memory_failure_stats *mf_stats = NULL;
> +
> +	nid = pfn_to_nid(pfn);
> +	if (unlikely(nid < 0 || nid >= MAX_NUMNODES)) {
> +		WARN_ONCE(1, "Memory failure: pfn=%#lx, invalid nid=%d", pfn, nid);
> +		return;
> +	}
> +
> +	mf_stats = &NODE_DATA(nid)->mf_stats;
> +	switch (result) {
> +	case MF_IGNORED:
> +		++mf_stats->pages_ignored;

What is the locking here, to prevent concurrent increments?

> +		break;
> +	case MF_FAILED:
> +		++mf_stats->pages_failed;
> +		break;
> +	case MF_DELAYED:
> +		++mf_stats->pages_delayed;
> +		break;
> +	case MF_RECOVERED:
> +		++mf_stats->pages_recovered;
> +		break;
> +	default:
> +		WARN_ONCE(1, "Memory failure: mf_result=%d is not properly handled", result);
> +		break;
> +	}
> +	++mf_stats->pages_poisoned;
> +}



  reply	other threads:[~2023-01-16 20:16 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-16 19:38 [PATCH v1 0/3] Introduce per NUMA node memory error statistics Jiaqi Yan
2023-01-16 19:39 ` [PATCH v1 1/3] mm: memory-failure: Add memory failure stats to sysfs Jiaqi Yan
2023-01-16 20:15   ` Andrew Morton
2023-01-17  9:14     ` HORIGUCHI NAOYA(堀口 直也)
2023-01-19 21:16       ` Jiaqi Yan
2023-01-17  9:02   ` HORIGUCHI NAOYA(堀口 直也)
2023-01-16 19:39 ` [PATCH v1 2/3] mm: memory-failure: Bump memory failure stats to pglist_data Jiaqi Yan
2023-01-16 20:16   ` Andrew Morton [this message]
2023-01-17  9:03     ` HORIGUCHI NAOYA(堀口 直也)
2023-01-18 23:05       ` Jiaqi Yan
2023-01-19  6:40         ` HORIGUCHI NAOYA(堀口 直也)
2023-01-19 18:05           ` Jiaqi Yan
2023-01-16 19:39 ` [PATCH v1 3/3] mm: memory-failure: Document memory failure stats Jiaqi Yan
2023-01-16 20:13 ` [PATCH v1 0/3] Introduce per NUMA node memory error statistics Andrew Morton
2023-01-16 21:52   ` Jiaqi Yan
2023-01-17  9:18 ` HORIGUCHI NAOYA(堀口 直也)
2023-01-17 17:51   ` Jiaqi Yan
2023-01-17 18:33     ` Luck, Tony
2023-01-18 17:31       ` Jiaqi Yan
2023-01-18 17:50         ` Luck, Tony
2023-01-18 23:33           ` Jiaqi Yan
2023-01-19  4:52             ` HORIGUCHI NAOYA(堀口 直也)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230116121613.234145e82988ca3e602dfce5@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=duenwen@google.com \
    --cc=jiaqiyan@google.com \
    --cc=linux-mm@kvack.org \
    --cc=naoya.horiguchi@nec.com \
    --cc=rientjes@google.com \
    --cc=shy828301@gmail.com \
    --cc=tony.luck@intel.com \
    --cc=wangkefeng.wang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox