<div dir="auto">I had a series which goes significantly further with stack reduction. What do you think about just going with that?<div dir="auto"><br></div><div dir="auto">I wonder if we should switch to dynamically allocating the slice stuff on ppc64</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 27 Feb. 2018 00:28, "Aneesh Kumar K.V" <<a href="mailto:aneesh.kumar@linux.vnet.ibm.com">aneesh.kumar@linux.vnet.ibm.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This patch kill potential_mask and compat_mask variable and instead use tmp_mask<br>
so that we can reduce the stack usage. This is required so that we can increase<br>
the high_slices bitmap to a larger value.<br>
<br>
The patch does result in extra computation in final stage, where it ends up<br>
recomputing the compat mask again.<br>
<br>
Signed-off-by: Aneesh Kumar K.V <<a href="mailto:aneesh.kumar@linux.vnet.ibm.com">aneesh.kumar@linux.vnet.ibm.<wbr>com</a>><br>
---<br>
arch/powerpc/mm/slice.c | 34 +++++++++++++++++-------------<wbr>----<br>
1 file changed, 17 insertions(+), 17 deletions(-)<br>
<br>
diff --git a/arch/powerpc/mm/slice.c b/arch/powerpc/mm/slice.c<br>
index 259bbda9a222..832c681c341a 100644<br>
--- a/arch/powerpc/mm/slice.c<br>
+++ b/arch/powerpc/mm/slice.c<br>
@@ -413,8 +413,7 @@ unsigned long slice_get_unmapped_area(<wbr>unsigned long addr, unsigned long len,<br>
{<br>
struct slice_mask mask;<br>
struct slice_mask good_mask;<br>
- struct slice_mask potential_mask;<br>
- struct slice_mask compat_mask;<br>
+ struct slice_mask tmp_mask;<br>
int fixed = (flags & MAP_FIXED);<br>
int pshift = max_t(int, mmu_psize_defs[psize].shift, PAGE_SHIFT);<br>
unsigned long page_size = 1UL << pshift;<br>
@@ -449,11 +448,8 @@ unsigned long slice_get_unmapped_area(<wbr>unsigned long addr, unsigned long len,<br>
bitmap_zero(mask.high_slices, SLICE_NUM_HIGH);<br>
<br>
/* silence stupid warning */;<br>
- potential_mask.low_slices = 0;<br>
- bitmap_zero(potential_mask.<wbr>high_slices, SLICE_NUM_HIGH);<br>
-<br>
- compat_mask.low_slices = 0;<br>
- bitmap_zero(compat_mask.high_<wbr>slices, SLICE_NUM_HIGH);<br>
+ tmp_mask.low_slices = 0;<br>
+ bitmap_zero(tmp_mask.high_<wbr>slices, SLICE_NUM_HIGH);<br>
<br>
/* Sanity checks */<br>
BUG_ON(mm->task_size == 0);<br>
@@ -502,9 +498,11 @@ unsigned long slice_get_unmapped_area(<wbr>unsigned long addr, unsigned long len,<br>
#ifdef CONFIG_PPC_64K_PAGES<br>
/* If we support combo pages, we can allow 64k pages in 4k slices */<br>
if (psize == MMU_PAGE_64K) {<br>
- slice_mask_for_size(mm, MMU_PAGE_4K, &compat_mask, high_limit);<br>
+ slice_mask_for_size(mm, MMU_PAGE_4K, &tmp_mask, high_limit);<br>
if (fixed)<br>
- slice_or_mask(&good_mask, &compat_mask);<br>
+ slice_or_mask(&good_mask, &tmp_mask);<br>
+<br>
+ slice_print_mask("Mask for compat page size", tmp_mask);<br>
}<br>
#endif<br>
/* First check hint if it's valid or if we have MAP_FIXED */<br>
@@ -541,11 +539,11 @@ unsigned long slice_get_unmapped_area(<wbr>unsigned long addr, unsigned long len,<br>
* We don't fit in the good mask, check what other slices are<br>
* empty and thus can be converted<br>
*/<br>
- slice_mask_for_free(mm, &potential_mask, high_limit);<br>
- slice_or_mask(&potential_mask, &good_mask);<br>
- slice_print_mask(" potential", potential_mask);<br>
+ slice_mask_for_free(mm, &tmp_mask, high_limit);<br>
+ slice_or_mask(&tmp_mask, &good_mask);<br>
+ slice_print_mask("Free area/potential ", tmp_mask);<br>
<br>
- if ((addr != 0 || fixed) && slice_check_fit(mm, mask, potential_mask)) {<br>
+ if ((addr != 0 || fixed) && slice_check_fit(mm, mask, tmp_mask)) {<br>
slice_dbg(" fits potential !\n");<br>
goto convert;<br>
}<br>
@@ -571,7 +569,7 @@ unsigned long slice_get_unmapped_area(<wbr>unsigned long addr, unsigned long len,<br>
/* Now let's see if we can find something in the existing slices<br>
* for that size plus free slices<br>
*/<br>
- addr = slice_find_area(mm, len, potential_mask,<br>
+ addr = slice_find_area(mm, len, tmp_mask,<br>
psize, topdown, high_limit);<br>
<br>
#ifdef CONFIG_PPC_64K_PAGES<br>
@@ -585,9 +583,10 @@ unsigned long slice_get_unmapped_area(<wbr>unsigned long addr, unsigned long len,<br>
* mask variable is free here. Use that for compat<br>
* size mask.<br>
*/<br>
+ slice_mask_for_size(mm, MMU_PAGE_4K, &mask, high_limit);<br>
/* retry the search with 4k-page slices included */<br>
- slice_or_mask(&potential_mask, &compat_mask);<br>
- addr = slice_find_area(mm, len, potential_mask,<br>
+ slice_or_mask(&tmp_mask, &mask);<br>
+ addr = slice_find_area(mm, len, tmp_mask,<br>
psize, topdown, high_limit);<br>
}<br>
#endif<br>
@@ -600,8 +599,9 @@ unsigned long slice_get_unmapped_area(<wbr>unsigned long addr, unsigned long len,<br>
slice_print_mask(" mask", mask);<br>
<br>
convert:<br>
+ slice_mask_for_size(mm, MMU_PAGE_4K, &tmp_mask, high_limit);<br>
slice_andnot_mask(&mask, &good_mask);<br>
- slice_andnot_mask(&mask, &compat_mask);<br>
+ slice_andnot_mask(&mask, &tmp_mask);<br>
if (mask.low_slices || !bitmap_empty(mask.high_<wbr>slices, SLICE_NUM_HIGH)) {<br>
slice_convert(mm, mask, psize);<br>
if (psize > MMU_PAGE_BASE)<br>
--<br>
2.14.3<br>
<br>
</blockquote></div></div>