Re: [RFC PATCH 1/5] powerpc/mm/slice: Convert slice_mask high slice to a bitmap
From: Balbir Singh <bsingharora@gmail.com>
Date: 2017-02-08 10:30:18
On Tue, Feb 07, 2017 at 09:18:49AM +0530, Aneesh Kumar K.V wrote:
quoted hunk ↗ jump to hunk
In followup patch we want to increase the va range which will result in us requiring high_slices to have more than 64 bits. To enable this convert high_slices to bitmap. We keep the number bits same in this patch and later change that to larger value Signed-off-by: Aneesh Kumar K.V <redacted> --- arch/powerpc/include/asm/page_64.h | 15 +++--- arch/powerpc/mm/slice.c | 106 ++++++++++++++++++++++++------------- 2 files changed, 76 insertions(+), 45 deletions(-)diff --git a/arch/powerpc/include/asm/page_64.h b/arch/powerpc/include/asm/page_64.h index dd5f0712afa2..7f72659b7999 100644 --- a/arch/powerpc/include/asm/page_64.h +++ b/arch/powerpc/include/asm/page_64.h@@ -98,19 +98,16 @@ extern u64 ppc64_pft_size; #define GET_LOW_SLICE_INDEX(addr) ((addr) >> SLICE_LOW_SHIFT) #define GET_HIGH_SLICE_INDEX(addr) ((addr) >> SLICE_HIGH_SHIFT) +#ifndef __ASSEMBLY__ struct slice_mask { u16 low_slices;
Can we move low_slices as well, although we don't need it it'll just make the code consistent.
quoted hunk ↗ jump to hunk
- u64 high_slices; + DECLARE_BITMAP(high_slices, 64); }; static void slice_print_mask(const char *label, struct slice_mask mask) { - char *p, buf[16 + 3 + 64 + 1]; + char *p, buf[SLICE_NUM_LOW + 3 + SLICE_NUM_HIGH + 1]; int i; if (!_slice_debug)@@ -60,8 +55,12 @@ static void slice_print_mask(const char *label, struct slice_mask mask) *(p++) = ' '; *(p++) = '-'; *(p++) = ' '; - for (i = 0; i < SLICE_NUM_HIGH; i++) - *(p++) = (mask.high_slices & (1ul << i)) ? '1' : '0'; + for (i = 0; i < SLICE_NUM_HIGH; i++) { + if (test_bit(i, mask.high_slices)) + *(p++) = '1'; + else + *(p++) = '0'; + }
Can we move to using %*pbl or bitmap_print_to_pagebuf
*(p++) = 0;
Balbir Singh.