Re: [PATCH] mm/hugetlb: Fix calculation of adjust_range_if_pmd_sharing_possible

2020-07-30 Thread Peter Xu
On Thu, Jul 30, 2020 at 08:57:22PM +0100, Matthew Wilcox wrote: > On Thu, Jul 30, 2020 at 03:50:30PM -0400, Peter Xu wrote: > > +#define MAX(a,b) (((a)>(b))?(a):(b)) > > +#define MIN(a,b) (((a)<(b))?(a):(b)) > > What's wrong with max() and min() defined in kernel.h? Oops.. Posting another one..

Re: [PATCH] mm/hugetlb: Fix calculation of adjust_range_if_pmd_sharing_possible

2020-07-30 Thread Matthew Wilcox
On Thu, Jul 30, 2020 at 03:50:30PM -0400, Peter Xu wrote: > +#define MAX(a,b) (((a)>(b))?(a):(b)) > +#define MIN(a,b) (((a)<(b))?(a):(b)) What's wrong with max() and min() defined in kernel.h?

[PATCH] mm/hugetlb: Fix calculation of adjust_range_if_pmd_sharing_possible

2020-07-30 Thread Peter Xu
This is found by code observation only. Firstly, the worst case scenario should assume the whole range was covered by pmd sharing. The old algorithm might not work as expected for ranges like (1g-2m, 1g+2m), where the adjusted range should be (0, 1g+2m) but the expected range should be (0, 2g).