[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210210133347.GD30109@lst.de>
Date: Wed, 10 Feb 2021 14:33:47 +0100
From: Christoph Hellwig <hch@....de>
To: Shiyang Ruan <ruansy.fnst@...fujitsu.com>
Cc: linux-kernel@...r.kernel.org, linux-xfs@...r.kernel.org,
linux-nvdimm@...ts.01.org, linux-mm@...ck.org,
linux-fsdevel@...r.kernel.org, dm-devel@...hat.com,
darrick.wong@...cle.com, dan.j.williams@...el.com,
david@...morbit.com, hch@....de, agk@...hat.com,
snitzer@...hat.com, rgoldwyn@...e.de, qi.fuli@...itsu.com,
y-goto@...itsu.com
Subject: Re: [PATCH v3 05/11] mm, fsdax: Refactor memory-failure handler
for dax mapping
> +extern int mf_dax_mapping_kill_procs(struct address_space *mapping, pgoff_t index, int flags);
No nee for the extern, please avoid the overly long line.
> @@ -120,6 +121,13 @@ static int hwpoison_filter_dev(struct page *p)
> if (PageSlab(p))
> return -EINVAL;
>
> + if (pfn_valid(page_to_pfn(p))) {
> + if (is_device_fsdax_page(p))
> + return 0;
> + else
> + return -EINVAL;
> + }
> +
This looks odd. For one there is no need for an else after a return.
But more importantly page_mapping() as called below pretty much assumes
a valid PFN, so something is fishy in this function.
> + if (is_zone_device_page(p)) {
> + if (is_device_fsdax_page(p))
> + tk->addr = vma->vm_start +
> + ((pgoff - vma->vm_pgoff) << PAGE_SHIFT);
The arithmetics here scream for a common helper, I suspect there might
be other places that could use the same helper.
> +int mf_dax_mapping_kill_procs(struct address_space *mapping, pgoff_t index, int flags)
Overly long line. Also the naming scheme with the mf_ seems rather
unusual. Maybe dax_kill_mapping_procs? Also please add a kerneldoc
comment describing the function given that it exported.
Powered by blists - more mailing lists