lkml.org 
[lkml]   [2022]   [Apr]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH v13 5/7] mm: Introduce mf_dax_kill_procs() for fsdax case
From
Date
On 2022/4/19 12:50, Shiyang Ruan wrote:
> This new function is a variant of mf_generic_kill_procs that accepts a
> file, offset pair instead of 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.
>
> Signed-off-by: Shiyang Ruan <ruansy.fnst@fujitsu.com>
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> ---
...
>
> +#ifdef CONFIG_FS_DAX
> +/**
> + * mf_dax_kill_procs - Collect and kill processes who are using this file range
> + * @mapping: the file in use
> + * @index: start pgoff of the range within the file

Might replacing 'file' with 'mapping' or 'address_space within file' will be better?

> + * @count: length of the range, in unit of PAGE_SIZE
> + * @mf_flags: memory failure flags
> + */
> +int mf_dax_kill_procs(struct address_space *mapping, pgoff_t index,
> + unsigned long count, int mf_flags)
> +{
> + LIST_HEAD(to_kill);
> + dax_entry_t cookie;
> + struct page *page;
> + size_t end = index + count;
> +
> + mf_flags |= MF_ACTION_REQUIRED | MF_MUST_KILL;
> +
> + for (; index < end; index++) {
> + page = NULL;
> + cookie = dax_lock_mapping_entry(mapping, index, &page);
> + if (!cookie)
> + return -EBUSY;
> + if (!page)
> + goto unlock;
> +

Should we do hwpoison_filter here?

> + SetPageHWPoison(page);
> +
> + collect_procs_fsdax(page, mapping, index, &to_kill);
> + unmap_and_kill(&to_kill, page_to_pfn(page), mapping,
> + index, mf_flags);
> +unlock:
> + dax_unlock_mapping_entry(mapping, index, cookie);
> + }
> + return 0;
> +}
> +EXPORT_SYMBOL_GPL(mf_dax_kill_procs);
> +#endif /* CONFIG_FS_DAX */
> +
> /*
> * Called from hugetlb code with hugetlb_lock held.
> *
>

Except from the above nit, this patch looks good to me. Thanks!

Reviewed-by: Miaohe Lin <linmiaohe@huawei.com>

\
 
 \ /
  Last update: 2022-04-21 10:48    [W:0.208 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site