[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170512013416.GA9545@bbox>
Date: Fri, 12 May 2017 10:34:16 +0900
From: Minchan Kim <minchan@...nel.org>
To: Johannes Weiner <hannes@...xchg.org>
Cc: "Huang, Ying" <ying.huang@...el.com>,
Andrew Morton <akpm@...ux-foundation.org>, linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
Andrea Arcangeli <aarcange@...hat.com>,
Ebru Akagunduz <ebru.akagunduz@...il.com>,
Michal Hocko <mhocko@...nel.org>, Tejun Heo <tj@...nel.org>,
Hugh Dickins <hughd@...gle.com>, Shaohua Li <shli@...nel.org>,
Rik van Riel <riel@...hat.com>, cgroups@...r.kernel.org
Subject: Re: [PATCH -mm -v10 1/3] mm, THP, swap: Delay splitting THP during
swap out
Hi Hannes,
On Thu, May 11, 2017 at 06:40:58AM -0400, Johannes Weiner wrote:
> On Thu, May 11, 2017 at 10:22:13AM +0900, Minchan Kim wrote:
> > On Thu, May 11, 2017 at 08:25:56AM +0900, Minchan Kim wrote:
> > > On Wed, May 10, 2017 at 09:56:54AM -0400, Johannes Weiner wrote:
> > > > Hi Michan,
> > > >
> > > > On Tue, May 02, 2017 at 08:53:32AM +0900, Minchan Kim wrote:
> > > > > @@ -1144,7 +1144,7 @@ void swap_free(swp_entry_t entry)
> > > > > /*
> > > > > * Called after dropping swapcache to decrease refcnt to swap entries.
> > > > > */
> > > > > -void swapcache_free(swp_entry_t entry)
> > > > > +void __swapcache_free(swp_entry_t entry)
> > > > > {
> > > > > struct swap_info_struct *p;
> > > > >
> > > > > @@ -1156,7 +1156,7 @@ void swapcache_free(swp_entry_t entry)
> > > > > }
> > > > >
> > > > > #ifdef CONFIG_THP_SWAP
> > > > > -void swapcache_free_cluster(swp_entry_t entry)
> > > > > +void __swapcache_free_cluster(swp_entry_t entry)
> > > > > {
> > > > > unsigned long offset = swp_offset(entry);
> > > > > unsigned long idx = offset / SWAPFILE_CLUSTER;
> > > > > @@ -1182,6 +1182,14 @@ void swapcache_free_cluster(swp_entry_t entry)
> > > > > }
> > > > > #endif /* CONFIG_THP_SWAP */
> > > > >
> > > > > +void swapcache_free(struct page *page, swp_entry_t entry)
> > > > > +{
> > > > > + if (!PageTransHuge(page))
> > > > > + __swapcache_free(entry);
> > > > > + else
> > > > > + __swapcache_free_cluster(entry);
> > > > > +}
> > > >
> > > > I don't think this is cleaner :/
> >
> > Let's see a example add_to_swap. Without it, it looks like that.
> >
> > int add_to_swap(struct page *page)
> > {
> > entry = get_swap_page(page);
> > ..
> > ..
> > fail:
> > if (PageTransHuge(page))
> > swapcache_free_cluster(entry);
> > else
> > swapcache_free(entry);
> > }
> >
> > It doesn't looks good to me because get_swap_page hides
> > where entry allocation is from cluster or slot but when
> > we free the entry allocated, we should be aware of the
> > internal and call right function. :(
>
> This could be nicer indeed. I just don't like the underscore versions
> much, but symmetry with get_swap_page() would be nice.
>
> How about put_swap_page()? :)
Good idea. It's the best one I can do now.
Actually, get_swap_page is awkward to me. Maybe it would be nicer to
rename it with get_swap_[slot|entry] but, I will postpone it if someone
would be on same page with me in future.
>
> That can call the appropriate swapcache_free function then.
Yub.
Thanks for the review!
Powered by blists - more mailing lists