All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Hubbard <jhubbard@nvidia.com>
To: Christoph Hellwig <hch@lst.de>, <john.hubbard@gmail.com>
Cc: "Andrew Morton" <akpm@linux-foundation.org>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Björn Töpel" <bjorn.topel@intel.com>,
	"Boaz Harrosh" <boaz@plexistor.com>,
	"Daniel Vetter" <daniel@ffwll.ch>,
	"Dan Williams" <dan.j.williams@intel.com>,
	"Dave Chinner" <david@fromorbit.com>,
	"David Airlie" <airlied@linux.ie>,
	"David S . Miller" <davem@davemloft.net>,
	"Ilya Dryomov" <idryomov@gmail.com>, "Jan Kara" <jack@suse.cz>,
	"Jason Gunthorpe" <jgg@ziepe.ca>, "Jens Axboe" <axboe@kernel.dk>,
	"Jérôme Glisse" <jglisse@redhat.com>,
	"Johannes Thumshirn" <jthumshirn@suse.de>,
	"Magnus Karlsson" <magnus.karlsson@intel.com>,
	"Matthew Wilcox" <willy@infradead.org>,
	"Miklos Szeredi" <miklos@szeredi.hu>,
	"Ming Lei" <ming.lei@redhat.com>, "Sage Weil" <sage@redhat.com>,
	"Santosh Shilimkar" <santosh.shilimkar@oracle.com>,
	"Yan Zheng" <zyan@redhat.com>,
	netdev@vger.kernel.org, dri-devel@lists.freedesktop.org,
	linux-mm@kvack.org, linux-rdma@vger.kernel.org,
	bpf@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/3] mm/gup: introduce __put_user_pages()
Date: Mon, 22 Jul 2019 23:33:32 -0700	[thread overview]
Message-ID: <8ab4899c-ec12-a713-cac2-d951fff2a347@nvidia.com> (raw)
In-Reply-To: <20190723055359.GC17148@lst.de>

On 7/22/19 10:53 PM, Christoph Hellwig wrote:
> On Mon, Jul 22, 2019 at 03:34:13PM -0700, john.hubbard@gmail.com wrote:
>> +enum pup_flags_t {
>> +	PUP_FLAGS_CLEAN		= 0,
>> +	PUP_FLAGS_DIRTY		= 1,
>> +	PUP_FLAGS_LOCK		= 2,
>> +	PUP_FLAGS_DIRTY_LOCK	= 3,
>> +};
> 
> Well, the enum defeats the ease of just being able to pass a boolean
> expression to the function, which would simplify a lot of the caller,
> so if we need to support the !locked version I'd rather see that as
> a separate helper.
> 
> But do we actually have callers where not using the _lock version is
> not a bug?  set_page_dirty makes sense in the context of a file systems
> that have a reference to the inode the page hangs off, but that is
> (almost?) never the case for get_user_pages.
> 

I'm seeing about 18 places where set_page_dirty() is used, in the call site
conversions so far, and about 20 places where set_page_dirty_lock() is
used. So without knowing how many of the former (if any) represent bugs,
you can see why the proposal here supports both DIRTY and DIRTY_LOCK.

Anyway, yes, I could change it, based on your estimation that most of the 
set_page_dirty() calls really should be set_page_dirty_lock().
In that case, we would end up with approximately the following:

/* Here, "dirty" really means, "call set_page_dirty_lock()": */
void __put_user_pages(struct page **pages, unsigned long npages,
		      bool dirty);

/* Here, "dirty" really means, "call set_page_dirty()": */
void __put_user_pages_unlocked(struct page **pages, unsigned long npages,
			       bool dirty);

?


thanks,
-- 
John Hubbard
NVIDIA

WARNING: multiple messages have this Message-ID (diff)
From: John Hubbard <jhubbard@nvidia.com>
To: Christoph Hellwig <hch@lst.de>, john.hubbard@gmail.com
Cc: "Boaz Harrosh" <boaz@plexistor.com>, "Jan Kara" <jack@suse.cz>,
	"David Airlie" <airlied@linux.ie>,
	"Dave Chinner" <david@fromorbit.com>,
	dri-devel@lists.freedesktop.org, linux-mm@kvack.org,
	"Sage Weil" <sage@redhat.com>,
	"Miklos Szeredi" <miklos@szeredi.hu>,
	linux-rdma@vger.kernel.org,
	"Matthew Wilcox" <willy@infradead.org>,
	"Jason Gunthorpe" <jgg@ziepe.ca>,
	"Johannes Thumshirn" <jthumshirn@suse.de>,
	"Ilya Dryomov" <idryomov@gmail.com>,
	"Björn Töpel" <bjorn.topel@intel.com>,
	"Santosh Shilimkar" <santosh.shilimkar@oracle.com>,
	"Ming Lei" <ming.lei@redhat.com>,
	"Jérôme Glisse" <jglisse@redhat.com>,
	"Alexander Viro" <viro@zeniv.linux.org.uk>,
	"Dan Williams" <dan.j.williams@intel.com>,
	bpf@vger.kernel.org,
	"Magnus Karlsson" <magnus.karlsson@intel.com>,
	"Jens Axboe" <axboe@kernel.dk>,
	netdev@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
	"Yan Zheng" <zyan@redhat.co>
Subject: Re: [PATCH 1/3] mm/gup: introduce __put_user_pages()
Date: Mon, 22 Jul 2019 23:33:32 -0700	[thread overview]
Message-ID: <8ab4899c-ec12-a713-cac2-d951fff2a347@nvidia.com> (raw)
In-Reply-To: <20190723055359.GC17148@lst.de>

On 7/22/19 10:53 PM, Christoph Hellwig wrote:
> On Mon, Jul 22, 2019 at 03:34:13PM -0700, john.hubbard@gmail.com wrote:
>> +enum pup_flags_t {
>> +	PUP_FLAGS_CLEAN		= 0,
>> +	PUP_FLAGS_DIRTY		= 1,
>> +	PUP_FLAGS_LOCK		= 2,
>> +	PUP_FLAGS_DIRTY_LOCK	= 3,
>> +};
> 
> Well, the enum defeats the ease of just being able to pass a boolean
> expression to the function, which would simplify a lot of the caller,
> so if we need to support the !locked version I'd rather see that as
> a separate helper.
> 
> But do we actually have callers where not using the _lock version is
> not a bug?  set_page_dirty makes sense in the context of a file systems
> that have a reference to the inode the page hangs off, but that is
> (almost?) never the case for get_user_pages.
> 

I'm seeing about 18 places where set_page_dirty() is used, in the call site
conversions so far, and about 20 places where set_page_dirty_lock() is
used. So without knowing how many of the former (if any) represent bugs,
you can see why the proposal here supports both DIRTY and DIRTY_LOCK.

Anyway, yes, I could change it, based on your estimation that most of the 
set_page_dirty() calls really should be set_page_dirty_lock().
In that case, we would end up with approximately the following:

/* Here, "dirty" really means, "call set_page_dirty_lock()": */
void __put_user_pages(struct page **pages, unsigned long npages,
		      bool dirty);

/* Here, "dirty" really means, "call set_page_dirty()": */
void __put_user_pages_unlocked(struct page **pages, unsigned long npages,
			       bool dirty);

?


thanks,
-- 
John Hubbard
NVIDIA
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

  reply	other threads:[~2019-07-23  6:35 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-22 22:34 [PATCH 0/3] introduce __put_user_pages(), convert a few call sites john.hubbard
2019-07-22 22:34 ` john.hubbard
2019-07-22 22:34 ` [PATCH 1/3] mm/gup: introduce __put_user_pages() john.hubbard
2019-07-22 22:34   ` john.hubbard
2019-07-23  5:53   ` Christoph Hellwig
2019-07-23  6:33     ` John Hubbard [this message]
2019-07-23  6:33       ` John Hubbard
2019-07-23 15:36       ` Christoph Hellwig
2019-07-23 15:36         ` Christoph Hellwig
2019-07-22 22:34 ` [PATCH 2/3] drivers/gpu/drm/via: convert put_page() to put_user_page*() john.hubbard
2019-07-22 22:34   ` john.hubbard
2019-07-22 22:34 ` [PATCH 3/3] net/xdp: " john.hubbard
2019-07-22 22:34   ` john.hubbard
2019-07-23  0:25   ` Ira Weiny
2019-07-23  0:25     ` Ira Weiny
2019-07-23  4:41     ` John Hubbard
2019-07-23  4:41       ` John Hubbard
2019-07-23 12:47       ` Jason Gunthorpe
2019-07-23 12:47         ` Jason Gunthorpe
2019-07-23 18:06       ` Ira Weiny
2019-07-23 18:06         ` Ira Weiny
2019-07-23 23:24         ` John Hubbard
2019-07-23 23:24           ` John Hubbard

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=8ab4899c-ec12-a713-cac2-d951fff2a347@nvidia.com \
    --to=jhubbard@nvidia.com \
    --cc=airlied@linux.ie \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=bjorn.topel@intel.com \
    --cc=boaz@plexistor.com \
    --cc=bpf@vger.kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=daniel@ffwll.ch \
    --cc=davem@davemloft.net \
    --cc=david@fromorbit.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hch@lst.de \
    --cc=idryomov@gmail.com \
    --cc=jack@suse.cz \
    --cc=jgg@ziepe.ca \
    --cc=jglisse@redhat.com \
    --cc=john.hubbard@gmail.com \
    --cc=jthumshirn@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=magnus.karlsson@intel.com \
    --cc=miklos@szeredi.hu \
    --cc=ming.lei@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=sage@redhat.com \
    --cc=santosh.shilimkar@oracle.com \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    --cc=zyan@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.