Re: [PATCH 1/2] mm: introduce put_user_page*(), placeholder versions

From: Matthew Wilcox
Date: Mon Dec 17 2018 - 14:59:31 EST


On Mon, Dec 17, 2018 at 02:54:08PM -0500, Jerome Glisse wrote:
> On Mon, Dec 17, 2018 at 11:51:51AM -0800, Matthew Wilcox wrote:
> > On Mon, Dec 17, 2018 at 02:48:00PM -0500, Jerome Glisse wrote:
> > > On Mon, Dec 17, 2018 at 10:34:43AM -0800, Matthew Wilcox wrote:
> > > > No. The solution John, Dan & I have been looking at is to take the
> > > > dirty page off the LRU while it is pinned by GUP. It will never be
> > > > found for writeback.
> > >
> > > With the solution you are proposing we loose GUP fast and we have to
> > > allocate a structure for each page that is under GUP, and the LRU
> > > changes too. Moreover by not writing back there is a greater chance
> > > of data loss.
> >
> > Why can't you store the hmm_data in a side data structure? Why does it
> > have to be in struct page?
>
> hmm_data is not even the issue here, we can have a pincount without
> moving things around. So i do not see the need to complexify any of
> the existing code to add new structure and consume more memory for
> no good reasons. I do not see any benefit in that.

You said "we have to allocate a structure for each page that is under
GUP". The only reason to do that is if we want to keep hmm_data in
struct page. If we ditch hmm_data, there's no need to allocate a
structure, and we don't lose GUP fast either.