Re: [PATCH v4 4/5] mm: Fix page reference leak in soft_offline_page()

2021-01-13 Thread 堀口 直也
On Wed, Jan 13, 2021 at 10:18:09PM -0800, Dan Williams wrote: > On Wed, Jan 13, 2021 at 5:50 PM HORIGUCHI NAOYA(堀口 直也) > wrote: > > > > On Wed, Jan 13, 2021 at 04:43:32PM -0800, Dan Williams wrote: > > > The conversion to move pfn_to_online_page() internal to > > > soft_offline_page() missed that

Re: [PATCH v4 4/5] mm: Fix page reference leak in soft_offline_page()

2021-01-13 Thread Oscar Salvador
On 2021-01-14 07:18, Dan Williams wrote: To be honest I dislike the entire flags based scheme for communicating the fact that page reference obtained by madvise needs to be dropped later. I'd rather pass a non-NULL 'struct page *' than redo pfn_to_page() conversions in the leaf functions, but

Re: [PATCH v4 4/5] mm: Fix page reference leak in soft_offline_page()

2021-01-13 Thread Dan Williams
On Wed, Jan 13, 2021 at 5:50 PM HORIGUCHI NAOYA(堀口 直也) wrote: > > On Wed, Jan 13, 2021 at 04:43:32PM -0800, Dan Williams wrote: > > The conversion to move pfn_to_online_page() internal to > > soft_offline_page() missed that the get_user_pages() reference taken by > > the madvise() path needs to

Re: [PATCH 04/10] mm, fsdax: Refactor memory-failure handler for dax mapping

2021-01-13 Thread Ruan Shiyang
On 2021/1/14 上午11:26, zhong jiang wrote: On 2021/1/14 9:44 上午, Ruan Shiyang wrote: On 2021/1/13 下午6:04, zhong jiang wrote: On 2021/1/12 10:55 上午, Ruan Shiyang wrote: On 2021/1/6 下午11:41, Jan Kara wrote: On Thu 31-12-20 00:55:55, Shiyang Ruan wrote: The current

Re: [PATCH 04/10] mm, fsdax: Refactor memory-failure handler for dax mapping

2021-01-13 Thread zhong jiang
On 2021/1/14 9:44 上午, Ruan Shiyang wrote: On 2021/1/13 下午6:04, zhong jiang wrote: On 2021/1/12 10:55 上午, Ruan Shiyang wrote: On 2021/1/6 下午11:41, Jan Kara wrote: On Thu 31-12-20 00:55:55, Shiyang Ruan wrote: The current memory_failure_dev_pagemap() can only handle single-mapped dax

Re: [PATCH v4 5/5] mm: Fix memory_failure() handling of dax-namespace metadata

2021-01-13 Thread 堀口 直也
On Wed, Jan 13, 2021 at 04:43:37PM -0800, Dan Williams wrote: > Given 'struct dev_pagemap' spans both data pages and metadata pages be > careful to consult the altmap if present to delineate metadata. In fact > the pfn_first() helper already identifies the first valid data pfn, so > export that

Re: [PATCH v4 4/5] mm: Fix page reference leak in soft_offline_page()

2021-01-13 Thread 堀口 直也
On Wed, Jan 13, 2021 at 04:43:32PM -0800, Dan Williams wrote: > The conversion to move pfn_to_online_page() internal to > soft_offline_page() missed that the get_user_pages() reference taken by > the madvise() path needs to be dropped when pfn_to_online_page() fails. > Note the direct sysfs-path

Re: [PATCH 04/10] mm, fsdax: Refactor memory-failure handler for dax mapping

2021-01-13 Thread Ruan Shiyang
On 2021/1/13 下午6:04, zhong jiang wrote: On 2021/1/12 10:55 上午, Ruan Shiyang wrote: On 2021/1/6 下午11:41, Jan Kara wrote: On Thu 31-12-20 00:55:55, Shiyang Ruan wrote: The current memory_failure_dev_pagemap() can only handle single-mapped dax page for fsdax mode.  The dax page could be

[PATCH v4 5/5] mm: Fix memory_failure() handling of dax-namespace metadata

2021-01-13 Thread Dan Williams
Given 'struct dev_pagemap' spans both data pages and metadata pages be careful to consult the altmap if present to delineate metadata. In fact the pfn_first() helper already identifies the first valid data pfn, so export that helper for other code paths via pgmap_pfn_valid(). Other usage of

[PATCH v4 4/5] mm: Fix page reference leak in soft_offline_page()

2021-01-13 Thread Dan Williams
The conversion to move pfn_to_online_page() internal to soft_offline_page() missed that the get_user_pages() reference taken by the madvise() path needs to be dropped when pfn_to_online_page() fails. Note the direct sysfs-path to soft_offline_page() does not perform a get_user_pages() lookup.

[PATCH v4 3/5] mm: Teach pfn_to_online_page() about ZONE_DEVICE section collisions

2021-01-13 Thread Dan Williams
While pfn_to_online_page() is able to determine pfn_valid() at subsection granularity it is not able to reliably determine if a given pfn is also online if the section is mixes ZONE_{NORMAL,MOVABLE} with ZONE_DEVICE. This means that pfn_to_online_page() may return invalid @page objects. For

[PATCH v4 2/5] mm: Teach pfn_to_online_page() to consider subsection validity

2021-01-13 Thread Dan Williams
pfn_section_valid() determines pfn validity on subsection granularity where pfn_valid() may be limited to coarse section granularity. Explicitly validate subsections after pfn_valid() succeeds. Fixes: b13bc35193d9 ("mm/hotplug: invalid PFNs from pfn_to_online_page()") Cc: Qian Cai Cc: Michal

[PATCH v4 1/5] mm: Move pfn_to_online_page() out of line

2021-01-13 Thread Dan Williams
pfn_to_online_page() is already too large to be a macro or an inline function. In anticipation of further logic changes / growth, move it out of line. No functional change, just code movement. Reported-by: Michal Hocko Reviewed-by: David Hildenbrand Reviewed-by: Oscar Salvador Signed-off-by:

[PATCH v4 0/5] mm: Fix pfn_to_online_page() with respect to ZONE_DEVICE

2021-01-13 Thread Dan Williams
Changes since v3 [1]: - Switch to "if (IS_ENABLED(CONFIG_HAVE_ARCH_PFN_VALID) && !pfn_valid(pfn))" (David) - Finish collecting reviewed-bys across all patches in the series - Drop the libnvdimm fixup, to be merged through nvdimm.git not -mm [1]:

Re: [PATCH v3 2/6] mm: Teach pfn_to_online_page() to consider subsection validity

2021-01-13 Thread Dan Williams
On Wed, Jan 13, 2021 at 12:29 AM David Hildenbrand wrote: > > On 13.01.21 08:35, Dan Williams wrote: > > pfn_section_valid() determines pfn validity on subsection granularity > > where pfn_valid() may be limited to coarse section granularity. > > Explicitly validate subsections after pfn_valid()

Re: Expense of read_iter

2021-01-13 Thread Mikulas Patocka
On Tue, 12 Jan 2021, Zhongwei Cai wrote: > > I'm working with Mingkai on optimizations for Ext4-dax. What specific patch are you working on? Please, post it somewhere. > We think that optmizing the read-iter method cannot achieve the > same performance as the read method for Ext4-dax. > We

Re: [PATCH 04/10] mm, fsdax: Refactor memory-failure handler for dax mapping

2021-01-13 Thread zhong jiang
On 2021/1/12 10:55 上午, Ruan Shiyang wrote: On 2021/1/6 下午11:41, Jan Kara wrote: On Thu 31-12-20 00:55:55, Shiyang Ruan wrote: The current memory_failure_dev_pagemap() can only handle single-mapped dax page for fsdax mode.  The dax page could be mapped by multiple files and offsets if we

Re: [PATCH v3 6/6] libnvdimm/namespace: Fix visibility of namespace resource attribute

2021-01-13 Thread Greg KH
On Tue, Jan 12, 2021 at 11:35:50PM -0800, Dan Williams wrote: > Legacy pmem namespaces lost support for the "resource" attribute when > the code was cleaned up to put the permission visibility in the > declaration. Restore this by listing 'resource' in the default > attributes. > > A new ndctl

Re: [PATCH v3 5/6] mm: Fix memory_failure() handling of dax-namespace metadata

2021-01-13 Thread David Hildenbrand
On 13.01.21 08:35, Dan Williams wrote: > Given 'struct dev_pagemap' spans both data pages and metadata pages be > careful to consult the altmap if present to delineate metadata. In fact > the pfn_first() helper already identifies the first valid data pfn, so > export that helper for other code

Re: [PATCH v3 2/6] mm: Teach pfn_to_online_page() to consider subsection validity

2021-01-13 Thread Oscar Salvador
On Tue, Jan 12, 2021 at 11:35:27PM -0800, Dan Williams wrote: > pfn_section_valid() determines pfn validity on subsection granularity > where pfn_valid() may be limited to coarse section granularity. > Explicitly validate subsections after pfn_valid() succeeds. > > Fixes: b13bc35193d9

Re: [PATCH v3 2/6] mm: Teach pfn_to_online_page() to consider subsection validity

2021-01-13 Thread David Hildenbrand
On 13.01.21 08:35, Dan Williams wrote: > pfn_section_valid() determines pfn validity on subsection granularity > where pfn_valid() may be limited to coarse section granularity. > Explicitly validate subsections after pfn_valid() succeeds. > > Fixes: b13bc35193d9 ("mm/hotplug: invalid PFNs from