lkml.org 
[lkml]   [2018]   [Jul]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH -mm -v4 05/21] mm, THP, swap: Support PMD swap mapping in free_swap_and_cache()/swap_free()
From
Date
On 07/10/2018 12:13 AM, Huang, Ying wrote:
> Dave Hansen <dave.hansen@linux.intel.com> writes:
>> The code non-resuse was, and continues to be, IMNHO, one of the largest
>> sources of bugs with the original THP implementation. It might be
>> infeasible to do here, but let's at least give it as much of a go as we can.
>
> I totally agree that we should unify the code path for huge and normal
> page/swap if possible. One concern is code size for !CONFIG_THP_SWAP.

I've honestly never heard that as an argument before. In general, our
.c files implement *full* functionality: the most complex case. The
headers #ifdef that functionality down because of our .config or
architecture.

The thing that matters here is debugging and reviewing the _complicated_
case, IMNHO.

> The original method is good for that. The new method may introduce some
> huge swap related code that is hard to be eliminated for
> !CONFIG_THP_SWAP. Andrew Morton pointed this out for the patchset of
> the first step of the THP swap optimization.
>
> This may be mitigated at least partly via,
>
> `
> #ifdef CONFIG_THP_SWAP
> #define nr_swap_entries(nr) (nr)
> #else
> #define nr_swap_entries(nr) 1
> #endif
>
> void do_something(swp_entry_t entry, int __nr_entries)
> {
> int i, nr_entries = nr_swap_entries(__nr_entries);
>
> if (nr_entries = SWAPFILE_CLUSTER)
> ; /* huge swap specific */
> else
> ; /* normal swap specific */
>
> for (i = 0; i < nr_entries; i++) {
> ; /* do something for each entry */
> }
>
> /* ... */
> }
> `

While that isn't perfect, it's better than the current state of things.

While you are refactoring things, I think you also need to take a good
look at roughly chopping this series in half by finding another stopping
point. You've done a great job so far of trickling this functionality
in so far, but 21 patches is quite a bit, and the set is only going to
get larger.

\
 
 \ /
  Last update: 2018-07-10 16:08    [W:0.113 / U:2.796 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site