All of lore.kernel.org
 help / color / mirror / Atom feed
* Why is NFS using a_ops->freepage?
@ 2017-10-05  8:36 ` Jan Kara
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2017-10-05  8:36 UTC (permalink / raw)
  To: linux-nfs, linux-mm; +Cc: Trond Myklebust, Anna Schumaker

Hello,

I'm doing some work in page cache handling and I have noticed that NFS is
the only user of mapping->a_ops->freepage callback. From a quick look I
don't see why isn't NFS using ->releasepage / ->invalidatepage callback as
all other filesystems do? I agree you would have to set PagePrivate bit for
those to get called for the directory mapping however that would seem like
a cleaner thing to do anyway - in fact you do have private data in the
page.  Just they are not pointed to by page->private but instead are stored
as page data... Am I missing something?

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Why is NFS using a_ops->freepage?
@ 2017-10-05  8:36 ` Jan Kara
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2017-10-05  8:36 UTC (permalink / raw)
  To: linux-nfs, linux-mm; +Cc: Trond Myklebust, Anna Schumaker

Hello,

I'm doing some work in page cache handling and I have noticed that NFS is
the only user of mapping->a_ops->freepage callback. From a quick look I
don't see why isn't NFS using ->releasepage / ->invalidatepage callback as
all other filesystems do? I agree you would have to set PagePrivate bit for
those to get called for the directory mapping however that would seem like
a cleaner thing to do anyway - in fact you do have private data in the
page.  Just they are not pointed to by page->private but instead are stored
as page data... Am I missing something?

								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why is NFS using a_ops->freepage?
  2017-10-05  8:36 ` Jan Kara
@ 2017-10-05 13:39   ` Trond Myklebust
  -1 siblings, 0 replies; 6+ messages in thread
From: Trond Myklebust @ 2017-10-05 13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XRlX2Zyb21fcGFnZV9jYWNoZSgpIGRvZXNuJ3QgY2FsbA0KcmVsZWFzZXBhZ2UgQUZBSUNTLg0K
DQpUaGUgcG9pbnQgb2YgZnJlZXBhZ2UgaXMgdGhhdCBpdCBpcyBjYWxsZWQgYWZ0ZXIgdGhlIHBh
Z2UgaGFzIGJlZW4NCnJlbW92ZWQgZnJvbSB0aGUgcGFnZSBjYWNoZS4NCg0KLS0gDQpUcm9uZCBN
eWtsZWJ1c3QNCkxpbnV4IE5GUyBjbGllbnQgbWFpbnRhaW5lciwgUHJpbWFyeURhdGENCnRyb25k
Lm15a2xlYnVzdEBwcmltYXJ5ZGF0YS5jb20NCg==


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why is NFS using a_ops->freepage?
@ 2017-10-05 13:39   ` Trond Myklebust
  0 siblings, 0 replies; 6+ messages in thread
From: Trond Myklebust @ 2017-10-05 13:39 UTC (permalink / raw)
  To: jack, linux-mm, linux-nfs; +Cc: anna.schumaker

Hi Jan,

On Thu, 2017-10-05 at 10:36 +0200, Jan Kara wrote:
> Hello,
> 
> I'm doing some work in page cache handling and I have noticed that
> NFS is
> the only user of mapping->a_ops->freepage callback. From a quick look
> I
> don't see why isn't NFS using ->releasepage / ->invalidatepage
> callback as
> all other filesystems do? I agree you would have to set PagePrivate
> bit for
> those to get called for the directory mapping however that would seem
> like
> a cleaner thing to do anyway - in fact you do have private data in
> the
> page.  Just they are not pointed to by page->private but instead are
> stored
> as page data... Am I missing something?
> 
> 								Honza

I'm not understanding your point. delete_from_page_cache() doesn't call
releasepage AFAICS.

The point of freepage is that it is called after the page has been
removed from the page cache.

-- 
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@primarydata.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why is NFS using a_ops->freepage?
  2017-10-05 13:39   ` Trond Myklebust
@ 2017-10-05 14:50     ` Jan Kara
  -1 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2017-10-05 14:50 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: jack, linux-mm, linux-nfs, anna.schumaker

On Thu 05-10-17 13:39:23, Trond Myklebust wrote:
> Hi Jan,
> 
> On Thu, 2017-10-05 at 10:36 +0200, Jan Kara wrote:
> > Hello,
> > 
> > I'm doing some work in page cache handling and I have noticed that
> > NFS is
> > the only user of mapping->a_ops->freepage callback. From a quick look
> > I
> > don't see why isn't NFS using ->releasepage / ->invalidatepage
> > callback as
> > all other filesystems do? I agree you would have to set PagePrivate
> > bit for
> > those to get called for the directory mapping however that would seem
> > like
> > a cleaner thing to do anyway - in fact you do have private data in
> > the
> > page.  Just they are not pointed to by page->private but instead are
> > stored
> > as page data... Am I missing something?
> > 
> > 								Honza
> 
> I'm not understanding your point. delete_from_page_cache() doesn't call
> releasepage AFAICS.

No, but before getting to delete_from_page_cache() the filesystem is
guaranteed to get either ->invalidatepage or ->releasepage callback called
(if it defines them). And at that point the page is already locked and on
its way to be destroyed. So my point was you could use these callbacks
instead to achieve the same...

If you are afraid of races, I don't think those can happen for NFS. Page
can be destroyed either because of truncate - at that point there's no risk
of anyone else looking at that page for directories (i_rwsem) - or because
of page reclaim - at which point we are guaranteed nobody else holds a
reference to the page and new reference cannot be acquired.


								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why is NFS using a_ops->freepage?
@ 2017-10-05 14:50     ` Jan Kara
  0 siblings, 0 replies; 6+ messages in thread
From: Jan Kara @ 2017-10-05 14:50 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: jack, linux-mm, linux-nfs, anna.schumaker

On Thu 05-10-17 13:39:23, Trond Myklebust wrote:
> Hi Jan,
> 
> On Thu, 2017-10-05 at 10:36 +0200, Jan Kara wrote:
> > Hello,
> > 
> > I'm doing some work in page cache handling and I have noticed that
> > NFS is
> > the only user of mapping->a_ops->freepage callback. From a quick look
> > I
> > don't see why isn't NFS using ->releasepage / ->invalidatepage
> > callback as
> > all other filesystems do? I agree you would have to set PagePrivate
> > bit for
> > those to get called for the directory mapping however that would seem
> > like
> > a cleaner thing to do anyway - in fact you do have private data in
> > the
> > page.  Just they are not pointed to by page->private but instead are
> > stored
> > as page data... Am I missing something?
> > 
> > 								Honza
> 
> I'm not understanding your point. delete_from_page_cache() doesn't call
> releasepage AFAICS.

No, but before getting to delete_from_page_cache() the filesystem is
guaranteed to get either ->invalidatepage or ->releasepage callback called
(if it defines them). And at that point the page is already locked and on
its way to be destroyed. So my point was you could use these callbacks
instead to achieve the same...

If you are afraid of races, I don't think those can happen for NFS. Page
can be destroyed either because of truncate - at that point there's no risk
of anyone else looking at that page for directories (i_rwsem) - or because
of page reclaim - at which point we are guaranteed nobody else holds a
reference to the page and new reference cannot be acquired.


								Honza
-- 
Jan Kara <jack@suse.com>
SUSE Labs, CR

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-10-05 14:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-05  8:36 Why is NFS using a_ops->freepage? Jan Kara
2017-10-05  8:36 ` Jan Kara
2017-10-05 13:39 ` Trond Myklebust
2017-10-05 13:39   ` Trond Myklebust
2017-10-05 14:50   ` Jan Kara
2017-10-05 14:50     ` Jan Kara

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.