Re: [PATCH v11 6/8] mm: Introduce mf_dax_kill_procs() for fsdax case
From: Christoph Hellwig
Date: Wed Mar 30 2022 - 01:51:51 EST
On Sun, Feb 27, 2022 at 08:07:45PM +0800, Shiyang Ruan wrote:
> This function is called at the end of RMAP routine, i.e. filesystem
> recovery function, to collect and kill processes using a shared page of
> DAX file.
I think just throwing RMAP inhere is rather confusing.
> The difference with mf_generic_kill_procs() is, it accepts
> file's (mapping,offset) instead of struct page because different files'
> mappings and offsets may share the same page in fsdax mode.
> It will be called when filesystem's RMAP results are found.
So maybe I'd word the whole log as something like:
This new function is a variant of mf_generic_kill_procs that accepts
a file, offset pair instead o a struct to support multiple files sharing
a DAX mapping. It is intended to be called by the file systems as
part of the memory_failure handler after the file system performed
a reverse mapping from the storage address to the file and file offset.
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@xxxxxx>
> index 9b1d56c5c224..0420189e4788 100644
> --- a/include/linux/mm.h
> +++ b/include/linux/mm.h
> @@ -3195,6 +3195,10 @@ enum mf_flags {
> MF_SOFT_OFFLINE = 1 << 3,
> MF_UNPOISON = 1 << 4,
> };
> +#if IS_ENABLED(CONFIG_FS_DAX)
> +int mf_dax_kill_procs(struct address_space *mapping, pgoff_t index,
> + unsigned long count, int mf_flags);
> +#endif /* CONFIG_FS_DAX */
No need for the ifdef here, having the stable declaration around is
just fine.
> +#if IS_ENABLED(CONFIG_FS_DAX)
No need for the IS_ENABLED as CONFIG_FS_DAX can't be modular.
A good old #ifdef will do it.
Otherwise looks good:
Reviewed-by: Christoph Hellwig <hch@xxxxxx>