[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwPqsxBquvAdgvEgE+stgvMi4ecw26zP7Q1Xi3N6fCRwQ@mail.gmail.com>
Date: Thu, 11 Aug 2016 13:35:00 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Christoph Hellwig <hch@....de>
Cc: "Huang, Ying" <ying.huang@...el.com>,
Dave Chinner <david@...morbit.com>,
LKML <linux-kernel@...r.kernel.org>,
Bob Peterson <rpeterso@...hat.com>,
Wu Fengguang <fengguang.wu@...el.com>, LKP <lkp@...org>
Subject: Re: [LKP] [lkp] [xfs] 68a9f5e700: aim7.jobs-per-min -13.6% regression
On Thu, Aug 11, 2016 at 1:00 PM, Christoph Hellwig <hch@....de> wrote:
>
> I can't really think of any reason why the pagefaul_disable() would
> sŃ–gnificantly change performance.
No, you're right, we prefault the page anyway.
And quite frankly, looking at it, I think the pagefault_disable/enable
is actually *correct*.
The thing is, iov_iter_copy_from_user_atomic() doesn't itself enforce
non-blocking user accesses, it depends on the caller blocking page
faults.
And the reason we want to block page faults is to make sure we don't
deadlock on the page we just locked for writing.
So looking at it, I think the pagefault_disable/enable is actually
needed, and it may in fact be a bug that mm/filemap.c doesn't do that.
However, see commit 00a3d660cbac ("Revert "fs: do not prefault
sys_write() user buffer pages"") about why mm/filemap.c doesn't do the
pagefault_disable().
But depending on the prefaulting actually guaranteeing that we don't
deadlock sounds like a nasty race in theory (ie somebody does mmap
tricks in another thread in between the pre-faulting and the final
copying).
Linus
Powered by blists - more mailing lists