[RFC] mm/swap: make release_pages() and put_pages() match
diff mbox series

Message ID 20190524193415.9733-1-ira.weiny@intel.com
State New
Headers show
Series
  • [RFC] mm/swap: make release_pages() and put_pages() match
Related show

Commit Message

Ira Weiny May 24, 2019, 7:34 p.m. UTC
From: Ira Weiny <ira.weiny@intel.com>

RFC I have no idea if this is correct or not.  But looking at
release_pages() I see a call to both __ClearPageActive() and
__ClearPageWaiters() while in __page_cache_release() I do not.

Is this a bug which needs to be fixed?  Did I miss clearing active
somewhere else in the call chain of put_page?

This was found via code inspection while determining if release_pages()
and the new put_user_pages() could be interchangeable.

Signed-off-by: Ira Weiny <ira.weiny@intel.com>
---
 mm/swap.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Shakeel Butt May 24, 2019, 7:44 p.m. UTC | #1
On Fri, May 24, 2019 at 12:33 PM <ira.weiny@intel.com> wrote:
>
> From: Ira Weiny <ira.weiny@intel.com>
>
> RFC I have no idea if this is correct or not.  But looking at
> release_pages() I see a call to both __ClearPageActive() and
> __ClearPageWaiters() while in __page_cache_release() I do not.
>
> Is this a bug which needs to be fixed?  Did I miss clearing active
> somewhere else in the call chain of put_page?
>
> This was found via code inspection while determining if release_pages()
> and the new put_user_pages() could be interchangeable.
>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> ---
>  mm/swap.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/mm/swap.c b/mm/swap.c
> index 3a75722e68a9..9d0432baddb0 100644
> --- a/mm/swap.c
> +++ b/mm/swap.c
> @@ -69,6 +69,7 @@ static void __page_cache_release(struct page *page)
>                 del_page_from_lru_list(page, lruvec, page_off_lru(page));

see page_off_lru(page) above which clear active bit.

>                 spin_unlock_irqrestore(&pgdat->lru_lock, flags);
>         }
> +       __ClearPageActive(page);
>         __ClearPageWaiters(page);
>         mem_cgroup_uncharge(page);
>  }
> --
> 2.20.1
>
Ira Weiny May 24, 2019, 8:08 p.m. UTC | #2
> 
> On Fri, May 24, 2019 at 12:33 PM <ira.weiny@intel.com> wrote:
> >
> > From: Ira Weiny <ira.weiny@intel.com>
> >
> > RFC I have no idea if this is correct or not.  But looking at
> > release_pages() I see a call to both __ClearPageActive() and
> > __ClearPageWaiters() while in __page_cache_release() I do not.
> >
> > Is this a bug which needs to be fixed?  Did I miss clearing active
> > somewhere else in the call chain of put_page?
> >
> > This was found via code inspection while determining if
> > release_pages() and the new put_user_pages() could be interchangeable.
> >
> > Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> > ---
> >  mm/swap.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/mm/swap.c b/mm/swap.c
> > index 3a75722e68a9..9d0432baddb0 100644
> > --- a/mm/swap.c
> > +++ b/mm/swap.c
> > @@ -69,6 +69,7 @@ static void __page_cache_release(struct page *page)
> >                 del_page_from_lru_list(page, lruvec,
> > page_off_lru(page));
> 
> see page_off_lru(page) above which clear active bit.

Thanks,  Sorry for the noise,
Ira


> 
> >                 spin_unlock_irqrestore(&pgdat->lru_lock, flags);
> >         }
> > +       __ClearPageActive(page);
> >         __ClearPageWaiters(page);
> >         mem_cgroup_uncharge(page);
> >  }
> > --
> > 2.20.1
> >

Patch
diff mbox series

diff --git a/mm/swap.c b/mm/swap.c
index 3a75722e68a9..9d0432baddb0 100644
--- a/mm/swap.c
+++ b/mm/swap.c
@@ -69,6 +69,7 @@  static void __page_cache_release(struct page *page)
 		del_page_from_lru_list(page, lruvec, page_off_lru(page));
 		spin_unlock_irqrestore(&pgdat->lru_lock, flags);
 	}
+	__ClearPageActive(page);
 	__ClearPageWaiters(page);
 	mem_cgroup_uncharge(page);
 }