* set_page_dirty variants
@ 2021-03-22 1:19 Matthew Wilcox
2021-03-23 15:41 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2021-03-22 1:19 UTC (permalink / raw)
To: linux-mm; +Cc: linux-fsdevel
We currently have three near-identical implementations of the
set_page_dirty address_space op:
__set_page_dirty_no_writeback added 2007 by Ken Chen (767193253bba)
(return value fixed by Bob Liu in 2011 (c3f0da631539))
anon_set_page_dirty added 2009 by Peter Zijlstra (d3a9262e59f7)
noop_set_page_dirty added 2018 by Dan Williams (f44c77630d26)
I persuaded Mike to remove hugetlbfs_set_page_dirty and
Daniel Vetter to remove fb_deferred_io_set_page_dirty (in -next)
so we're down from five to three.
I'd like to get it down to zero. After all, the !mapping case in
set_page_dirty() is exactly what we want. So is there a problem
with doing this?
+++ b/mm/page-writeback.c
@@ -2562 +2562 @@ int set_page_dirty(struct page *page)
- if (likely(mapping)) {
+ if (likely(mapping && mapping_can_writeback(mapping))) {
But then I noticed that we have both mapping_can_writeback()
and mapping_use_writeback_tags(), and I'm no longer sure
which one to use. Also, why don't we mirror the results of
inode_to_bdi(mapping->host)->capabilities & BDI_CAP_WRITEBACK into
a mapping->flags & AS_something bit? We have lots available, and
inode_to_bdi seems relatively complicated to be a static inline that
gets evaluated every time we call
pagecache_get_page(FGP_CREAT | FGP_WRITE).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: set_page_dirty variants
2021-03-22 1:19 set_page_dirty variants Matthew Wilcox
@ 2021-03-23 15:41 ` Christoph Hellwig
2021-03-23 16:30 ` Matthew Wilcox
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Hellwig @ 2021-03-23 15:41 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: linux-mm, linux-fsdevel
On Mon, Mar 22, 2021 at 01:19:07AM +0000, Matthew Wilcox wrote:
> I'd like to get it down to zero. After all, the !mapping case in
> set_page_dirty() is exactly what we want. So is there a problem
> with doing this?
>
> +++ b/mm/page-writeback.c
> @@ -2562 +2562 @@ int set_page_dirty(struct page *page)
> - if (likely(mapping)) {
> + if (likely(mapping && mapping_can_writeback(mapping))) {
>
> But then I noticed that we have both mapping_can_writeback()
> and mapping_use_writeback_tags(), and I'm no longer sure
> which one to use. Also, why don't we mirror the results of
> inode_to_bdi(mapping->host)->capabilities & BDI_CAP_WRITEBACK into
> a mapping->flags & AS_something bit?
Probably because no one has bothered to submit a patch yet.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: set_page_dirty variants
2021-03-23 15:41 ` Christoph Hellwig
@ 2021-03-23 16:30 ` Matthew Wilcox
2021-03-23 16:35 ` Christoph Hellwig
0 siblings, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2021-03-23 16:30 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: linux-mm, linux-fsdevel
On Tue, Mar 23, 2021 at 03:41:25PM +0000, Christoph Hellwig wrote:
> On Mon, Mar 22, 2021 at 01:19:07AM +0000, Matthew Wilcox wrote:
> > I'd like to get it down to zero. After all, the !mapping case in
> > set_page_dirty() is exactly what we want. So is there a problem
> > with doing this?
> >
> > +++ b/mm/page-writeback.c
> > @@ -2562 +2562 @@ int set_page_dirty(struct page *page)
> > - if (likely(mapping)) {
> > + if (likely(mapping && mapping_can_writeback(mapping))) {
> >
> > But then I noticed that we have both mapping_can_writeback()
> > and mapping_use_writeback_tags(), and I'm no longer sure
> > which one to use. Also, why don't we mirror the results of
> > inode_to_bdi(mapping->host)->capabilities & BDI_CAP_WRITEBACK into
> > a mapping->flags & AS_something bit?
>
> Probably because no one has bothered to submit a patch yet.
I was hoping for a little more guidance. Are mapping_can_writeback()
and mapping_use_writeback_tags() really the same thing? I mean,
obviously the swap spaces actually _can_ writeback, but it doesn't
use the tags to do it.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: set_page_dirty variants
2021-03-23 16:30 ` Matthew Wilcox
@ 2021-03-23 16:35 ` Christoph Hellwig
0 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2021-03-23 16:35 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: Christoph Hellwig, linux-mm, linux-fsdevel
On Tue, Mar 23, 2021 at 04:30:27PM +0000, Matthew Wilcox wrote:
> On Tue, Mar 23, 2021 at 03:41:25PM +0000, Christoph Hellwig wrote:
> > On Mon, Mar 22, 2021 at 01:19:07AM +0000, Matthew Wilcox wrote:
> > > I'd like to get it down to zero. After all, the !mapping case in
> > > set_page_dirty() is exactly what we want. So is there a problem
> > > with doing this?
> > >
> > > +++ b/mm/page-writeback.c
> > > @@ -2562 +2562 @@ int set_page_dirty(struct page *page)
> > > - if (likely(mapping)) {
> > > + if (likely(mapping && mapping_can_writeback(mapping))) {
> > >
> > > But then I noticed that we have both mapping_can_writeback()
> > > and mapping_use_writeback_tags(), and I'm no longer sure
> > > which one to use. Also, why don't we mirror the results of
> > > inode_to_bdi(mapping->host)->capabilities & BDI_CAP_WRITEBACK into
> > > a mapping->flags & AS_something bit?
> >
> > Probably because no one has bothered to submit a patch yet.
>
> I was hoping for a little more guidance. Are mapping_can_writeback()
> and mapping_use_writeback_tags() really the same thing? I mean,
> obviously the swap spaces actually _can_ writeback, but it doesn't
> use the tags to do it.
Have you looked at the commit adding mapping_use_writeback_tags? It
pretty clearly documents that as of that commit the swap cache does not
use writeback tags and why.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-23 16:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 1:19 set_page_dirty variants Matthew Wilcox
2021-03-23 15:41 ` Christoph Hellwig
2021-03-23 16:30 ` Matthew Wilcox
2021-03-23 16:35 ` Christoph Hellwig
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).