Re: Re: [PATCH v5 1/1] mm/memory-failure: disable unpoison once hw error happens

From: Oscar Salvador
Date: Wed Jun 15 2022 - 01:52:15 EST


On Wed, Jun 15, 2022 at 01:18:23PM +0800, zhenwei pi wrote:
> Hi,
>
> Because memory_failure() may be called by hardware error randomly,
> hw_memory_failure should be protected by mf_mutex to avoid this case:
> int unpoison_memory(unsigned long pfn)
> {
> ...
> if (hw_memory_failure) {
> }
> ... --> memory_failure() happens, and mark hw_memory_failure as true
> mutex_lock(&mf_mutex);

Yeah, I am aware of that.
But once memory_failure() sets hw_memory_failure to true, it does not really matter
whether unpoison_memory() checks that while holding or not the lock, does it?

Note that it does not really matter in the end, but I am just curious whether
there is any strong impediment to that.


--
Oscar Salvador
SUSE Labs