From: "Williams, Dan J" <dan.j.williams@intel.com>
To: "jmoyer@redhat.com" <jmoyer@redhat.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-nvdimm@ml01.01.org" <linux-nvdimm@ml01.01.org>,
"hch@lst.de" <hch@lst.de>,
"akpm@linux-foundation.org" <akpm@linux-foundation.org>,
"axboe@fb.com" <axboe@fb.com>, "jack@suse.com" <jack@suse.com>,
"david@fromorbit.com" <david@fromorbit.com>,
"jack@suse.cz" <jack@suse.cz>
Subject: Re: [PATCH v2 2/5] dax: increase granularity of dax_clear_blocks() operations
Date: Thu, 22 Oct 2015 22:57:37 +0000 [thread overview]
Message-ID: <1445554654.17208.14.camel@intel.com> (raw)
In-Reply-To: <x49oafqfwdi.fsf@segfault.boston.devel.redhat.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset="utf-8", Size: 2680 bytes --]
On Thu, 2015-10-22 at 17:04 -0400, Jeff Moyer wrote:
> Dan Williams <dan.j.williams@intel.com> writes:
>
> > dax_clear_blocks is currently performing a cond_resched() after every
> > PAGE_SIZE memset. We need not check so frequently, for example md-raid
> > only calls cond_resched() at stripe granularity. Also, in preparation
> > for introducing a dax_map_atomic() operation that temporarily pins a dax
> > mapping move the call to cond_resched() to the outer loop.
>
> There's nothing wrong with the mechanics here, but why bother? I only
> see 1 caller in the kernel, and that caller passes in
> 1<<inode->i_blkbits for the size (so 1 page or less). Did you plan to
> add other callers? I don't see them in this particular patch set.
>
> Again, I'm not taking issue with the patch, I'm just wondering what
> motivated the change.
The motivation is the subsequent patch to wrap all touches of pmem
within a dax_map_atomic() / dax_unmap_atomic() pairing. If I just do
the straightforward conversion of this function to dax_map_atomic() it
looks something like this:
> diff --git a/fs/dax.c b/fs/dax.c
> index 5dc33d788d50..fa2a2a255d3a 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -40,9 +40,9 @@ int dax_clear_blocks(struct inode *inode, sector_t block, long size)
> unsigned long pfn;
> long count;
>
> - count = bdev_direct_access(bdev, sector, &addr, &pfn, size);
> - if (count < 0)
> - return count;
> + addr = __dax_map_atomic(bdev, sector, size, &pfn, &count);
> + if (IS_ERR(addr))
> + return PTR_ERR(addr);
> BUG_ON(size < count);
> while (count > 0) {
> unsigned pgsz = PAGE_SIZE - offset_in_page(addr);
> @@ -56,6 +56,7 @@ int dax_clear_blocks(struct inode *inode, sector_t block, long size)
> sector += pgsz / 512;
> cond_resched();
> }
> + dax_unmap_atomic(bdev, addr);
> } while (size);
>
> wmb_pmem();
The problem is that intervening call to cond_resched(). I later want to
inject an rcu_read_lock()/unlock() pair to allow flushing active
dax_map_atomic() usages at driver teardown time [1]. But, I think the
patch stands alone as a cleanup outside of that admittedly hidden
motivation.
[1]: "mm, pmem: devm_memunmap_pages(), truncate and unmap ZONE_DEVICE
pages"
https://lists.01.org/pipermail/linux-nvdimm/2015-October/002406.html
ÿôèº{.nÇ+·®+%Ëÿ±éݶ\x17¥wÿº{.nÇ+·¥{±þG«éÿ{ayº\x1dÊÚë,j\a¢f£¢·hïêÿêçz_è®\x03(éÝ¢j"ú\x1a¶^[m§ÿÿ¾\a«þG«éÿ¢¸?¨èÚ&£ø§~á¶iOæ¬z·vØ^\x14\x04\x1a¶^[m§ÿÿÃ\fÿ¶ìÿ¢¸?I¥
next prev parent reply other threads:[~2015-10-22 22:57 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-22 17:10 [PATCH v2 0/5] block, dax: updates for 4.4 Dan Williams
2015-10-22 17:10 ` [PATCH v2 1/5] pmem, dax: clean up clear_pmem() Dan Williams
2015-10-22 20:48 ` Jeff Moyer
2015-10-22 22:29 ` Dan Williams
2015-10-28 21:01 ` Jeff Moyer
2015-10-27 17:31 ` Ross Zwisler
2015-10-22 17:10 ` [PATCH v2 2/5] dax: increase granularity of dax_clear_blocks() operations Dan Williams
2015-10-22 21:04 ` Jeff Moyer
2015-10-22 22:57 ` Williams, Dan J [this message]
2015-10-28 21:02 ` Jeff Moyer
2015-10-22 17:10 ` [PATCH v2 3/5] block, dax: fix lifetime of in-kernel dax mappings with dax_map_atomic() Dan Williams
2015-10-28 20:15 ` Jeff Moyer
2015-10-22 17:10 ` [PATCH v2 4/5] block: introduce bdev_file_inode() Dan Williams
2015-10-22 20:37 ` Jan Kara
2015-10-28 20:16 ` Jeff Moyer
2015-10-22 17:10 ` [PATCH v2 5/5] block: enable dax for raw block devices Dan Williams
2015-10-28 20:50 ` Jeff Moyer
2015-10-29 7:14 ` 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=1445554654.17208.14.camel@intel.com \
--to=dan.j.williams@intel.com \
--cc=akpm@linux-foundation.org \
--cc=axboe@fb.com \
--cc=david@fromorbit.com \
--cc=hch@lst.de \
--cc=jack@suse.com \
--cc=jack@suse.cz \
--cc=jmoyer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nvdimm@ml01.01.org \
/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;
as well as URLs for NNTP newsgroup(s).