[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <68579c32-268f-0431-72e9-d3d104bc10bf@huawei.com>
Date: Thu, 21 Apr 2022 16:47:28 +0800
From: Miaohe Lin <linmiaohe@...wei.com>
To: Shiyang Ruan <ruansy.fnst@...itsu.com>
CC: <djwong@...nel.org>, <dan.j.williams@...el.com>,
<david@...morbit.com>, <hch@...radead.org>, <jane.chu@...cle.com>,
Christoph Hellwig <hch@....de>, <linux-kernel@...r.kernel.org>,
<linux-xfs@...r.kernel.org>, <nvdimm@...ts.linux.dev>,
<linux-mm@...ck.org>, <linux-fsdevel@...r.kernel.org>
Subject: Re: [PATCH v13 5/7] mm: Introduce mf_dax_kill_procs() for fsdax case
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@...itsu.com>
> Reviewed-by: Dan Williams <dan.j.williams@...el.com>
> Reviewed-by: Christoph Hellwig <hch@....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@...wei.com>
Powered by blists - more mailing lists