File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -1689,6 +1689,7 @@ unsigned long shmem_allowable_huge_orders(struct inode *inode,
1689
1689
unsigned long mask = READ_ONCE (huge_shmem_orders_always );
1690
1690
unsigned long within_size_orders = READ_ONCE (huge_shmem_orders_within_size );
1691
1691
unsigned long vm_flags = vma ? vma -> vm_flags : 0 ;
1692
+ pgoff_t aligned_index ;
1692
1693
bool global_huge ;
1693
1694
loff_t i_size ;
1694
1695
int order ;
@@ -1723,9 +1724,9 @@ unsigned long shmem_allowable_huge_orders(struct inode *inode,
1723
1724
/* Allow mTHP that will be fully within i_size. */
1724
1725
order = highest_order (within_size_orders );
1725
1726
while (within_size_orders ) {
1726
- index = round_up (index + 1 , order );
1727
+ aligned_index = round_up (index + 1 , 1 << order );
1727
1728
i_size = round_up (i_size_read (inode ), PAGE_SIZE );
1728
- if (i_size >> PAGE_SHIFT >= index ) {
1729
+ if (i_size >> PAGE_SHIFT >= aligned_index ) {
1729
1730
mask |= within_size_orders ;
1730
1731
break ;
1731
1732
}
You can’t perform that action at this time.
0 commit comments