提交 0e5f35d0 编写于 作者: A Aneesh Kumar K.V 提交者: Benjamin Herrenschmidt

powerpc: Don't truncate pgd_index wrongly

With PGD_INDEX_SIZE set to 12 the existing macro doesn't work. Fix it to
use PTRS_PER_PGD

The idea originally was to have one more bit in the result of
pgd_index() than PGD_INDEX_SIZE, so that if one had an address
corresponding to the last PGD entry, and then incremented that address
by PGD_SIZE, and took pgd_index() of that, you wouldn't end up with
zero.  The commit that introduced that dates back to 2002, and the
code that was sensitive to that edge case has long since been
refactored (several times), so there is no need for it these days.
Signed-off-by: NAneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Acked-by: NPaul Mackerras <paulus@samba.org>
Signed-off-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
上级 cc3665a6
...@@ -167,8 +167,7 @@ ...@@ -167,8 +167,7 @@
* Find an entry in a page-table-directory. We combine the address region * Find an entry in a page-table-directory. We combine the address region
* (the high order N bits) and the pgd portion of the address. * (the high order N bits) and the pgd portion of the address.
*/ */
/* to avoid overflow in free_pgtables we don't use PTRS_PER_PGD here */ #define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & (PTRS_PER_PGD - 1))
#define pgd_index(address) (((address) >> (PGDIR_SHIFT)) & 0x1ff)
#define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address)) #define pgd_offset(mm, address) ((mm)->pgd + pgd_index(address))
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册