From: Jan Kara <jack@suse.cz>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-nvdimm@lists.01.org, Jan Kara <jack@suse.cz>,
Christoph Hellwig <hch@lst.de>,
Matthew Wilcox <mawilcox@microsoft.com>,
Ross Zwisler <ross.zwisler@linux.intel.com>,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v3 05/12] filesystem-dax: Set page->index
Date: Thu, 7 Jun 2018 18:02:54 +0200 [thread overview]
Message-ID: <20180607160254.hafu4qpyk5hshn42@quack2.suse.cz> (raw)
In-Reply-To: <152815392667.39010.251950144812632482.stgit@dwillia2-desk3.amr.corp.intel.com>
On Mon 04-06-18 16:12:06, Dan Williams wrote:
> In support of enabling memory_failure() handling for filesystem-dax
> mappings, set ->index to the pgoff of the page. The rmap implementation
> requires ->index to bound the search through the vma interval tree. The
> index is set and cleared at dax_associate_entry() and
> dax_disassociate_entry() time respectively.
>
> Cc: Jan Kara <jack@suse.cz>
> Cc: Christoph Hellwig <hch@lst.de>
> Cc: Matthew Wilcox <mawilcox@microsoft.com>
> Cc: Ross Zwisler <ross.zwisler@linux.intel.com>
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Looks good to me. You can add:
Reviewed-by: Jan Kara <jack@suse.cz>
Honza
> ---
> fs/dax.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/fs/dax.c b/fs/dax.c
> index aaec72ded1b6..cccf6cad1a7a 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -319,18 +319,27 @@ static unsigned long dax_radix_end_pfn(void *entry)
> for (pfn = dax_radix_pfn(entry); \
> pfn < dax_radix_end_pfn(entry); pfn++)
>
> -static void dax_associate_entry(void *entry, struct address_space *mapping)
> +/*
> + * TODO: for reflink+dax we need a way to associate a single page with
> + * multiple address_space instances at different linear_page_index()
> + * offsets.
> + */
> +static void dax_associate_entry(void *entry, struct address_space *mapping,
> + struct vm_area_struct *vma, unsigned long address)
> {
> - unsigned long pfn;
> + unsigned long size = dax_entry_size(entry), pfn, index;
> + int i = 0;
>
> if (IS_ENABLED(CONFIG_FS_DAX_LIMITED))
> return;
>
> + index = linear_page_index(vma, address & ~(size - 1));
> for_each_mapped_pfn(entry, pfn) {
> struct page *page = pfn_to_page(pfn);
>
> WARN_ON_ONCE(page->mapping);
> page->mapping = mapping;
> + page->index = index + i++;
> }
> }
>
> @@ -348,6 +357,7 @@ static void dax_disassociate_entry(void *entry, struct address_space *mapping,
> WARN_ON_ONCE(trunc && page_ref_count(page) > 1);
> WARN_ON_ONCE(page->mapping && page->mapping != mapping);
> page->mapping = NULL;
> + page->index = 0;
> }
> }
>
> @@ -604,7 +614,7 @@ static void *dax_insert_mapping_entry(struct address_space *mapping,
> new_entry = dax_radix_locked_entry(pfn, flags);
> if (dax_entry_size(entry) != dax_entry_size(new_entry)) {
> dax_disassociate_entry(entry, mapping, false);
> - dax_associate_entry(new_entry, mapping);
> + dax_associate_entry(new_entry, mapping, vmf->vma, vmf->address);
> }
>
> if (dax_is_zero_entry(entry) || dax_is_empty_entry(entry)) {
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
next prev parent reply other threads:[~2018-06-07 16:02 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-04 23:11 [PATCH v3 00/12] mm: Teach memory_failure() about ZONE_DEVICE pages Dan Williams
2018-06-04 23:11 ` [PATCH v3 01/12] device-dax: Convert to vmf_insert_mixed and vm_fault_t Dan Williams
2018-06-04 23:11 ` [PATCH v3 02/12] device-dax: Cleanup vm_fault de-reference chains Dan Williams
2018-06-04 23:11 ` [PATCH v3 03/12] device-dax: Enable page_mapping() Dan Williams
2018-06-07 15:39 ` Jan Kara
2018-06-04 23:12 ` [PATCH v3 04/12] device-dax: Set page->index Dan Williams
2018-06-07 15:50 ` Jan Kara
2018-06-04 23:12 ` [PATCH v3 05/12] filesystem-dax: " Dan Williams
2018-06-07 16:02 ` Jan Kara [this message]
2018-06-04 23:12 ` [PATCH v3 06/12] mm, madvise_inject_error: Let memory_failure() optionally take a page reference Dan Williams
2018-06-04 23:12 ` [PATCH v3 07/12] x86/mm/pat: Prepare {reserve, free}_memtype() for "decoy" addresses Dan Williams
2018-06-04 23:12 ` [PATCH v3 08/12] x86/memory_failure: Introduce {set, clear}_mce_nospec() Dan Williams
2018-06-07 4:42 ` Dan Williams
2018-06-07 17:02 ` Luck, Tony
2018-06-04 23:12 ` [PATCH v3 09/12] mm, memory_failure: Pass page size to kill_proc() Dan Williams
2018-06-04 23:12 ` [PATCH v3 10/12] mm, memory_failure: Fix page->mapping assumptions relative to the page lock Dan Williams
2018-06-04 23:12 ` [PATCH v3 11/12] mm, memory_failure: Teach memory_failure() about dev_pagemap pages Dan Williams
2018-06-07 4:22 ` Dan Williams
2018-06-07 16:30 ` Jan Kara
2018-06-07 16:45 ` Dan Williams
2018-06-04 23:12 ` [PATCH v3 12/12] libnvdimm, pmem: Restore page attributes when clearing errors Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180607160254.hafu4qpyk5hshn42@quack2.suse.cz \
--to=jack@suse.cz \
--cc=dan.j.williams@intel.com \
--cc=hch@lst.de \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-nvdimm@lists.01.org \
--cc=mawilcox@microsoft.com \
--cc=ross.zwisler@linux.intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox