linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: Matthew Wilcox <willy@infradead.org>,
	"Darrick J. Wong" <djwong@kernel.org>
Cc: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Christoph Hellwig <hch@lst.de>
Subject: Re: [PATCH 1/2] iomap: Use kmap_local_page instead of kmap_atomic
Date: Tue, 10 Aug 2021 23:18:38 +0200	[thread overview]
Message-ID: <87mtppov69.ffs@tglx> (raw)
In-Reply-To: <YQws3DQyk6pnyiBY@casper.infradead.org>

On Thu, Aug 05 2021 at 19:24, Matthew Wilcox wrote:
> On Thu, Aug 05, 2021 at 10:39:03AM -0700, Darrick J. Wong wrote:
>> Though now that I think about it: Why does iomap_write_actor still use
>> copy_page_from_iter_atomic?  Can that be converted to use regular
>> copy_page_from_iter, which at least sometimes uses kmap_local_page?
>
> I suspect copy_page_from_iter_atomic() should be converted to use
> kmap_local_page(), but I don't know.  generic_perform_write() uses
> the _atomic() version, so I'm not doing anything different without
> understanding more than I currently do.

Most of the kmap_atomic() usage can be converted to kmap_local(). There
are only a few usage sites which really depend on the implicit preempt
disable.

The reason why we cannot convert the bulk blindly is that quite some
usage sites have user memory access nested inside. As kmap_atomic()
disables preemption and page faults the error handling needs to be
outside the atomic section, i.e. after kunmap_atomic(). So if you
convert that you have to get rid of that extra error handling and just
use the regular user memory accessors.

IIRC there are a few places which really want pagefaults disabled, but
those do not necessarily need preemption disabled. So they need to be
converted to kmap_local(); pagefault_disable(); err = dostuff(); ....

Hope that helps.

Thanks

        tglx

      reply	other threads:[~2021-08-10 21:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-03 19:31 [PATCH 1/2] iomap: Use kmap_local_page instead of kmap_atomic Matthew Wilcox (Oracle)
2021-08-03 19:31 ` [PATCH 2/2] iomap: Add another assertion to inline data handling Matthew Wilcox (Oracle)
2021-08-05 17:31   ` Darrick J. Wong
2021-08-05 17:31 ` [PATCH 1/2] iomap: Use kmap_local_page instead of kmap_atomic Darrick J. Wong
2021-08-05 17:39   ` Darrick J. Wong
2021-08-05 18:24     ` Matthew Wilcox
2021-08-10 21:18       ` Thomas Gleixner [this message]

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=87mtppov69.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=djwong@kernel.org \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.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).