Offering: HULK hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I6HRGK
------------------------------------------------
Add config to encapsulate the code introduced in 2fb141bf9c23 ("[Huawei] mm: sharepool: fix hugepage_rsvd count increase error").
Signed-off-by: Zhang Zekun zhangzekun11@huawei.com --- fs/hugetlbfs/inode.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index cfdd8cffe6d7..58d1dd32a223 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -602,13 +602,20 @@ static void remove_inode_hugepages(struct inode *inode, loff_t lstart, * if the page is from buddy system, do not add to freed. * because freed is used for hugetlbfs reservation accounting. */ - if (!HPageTemporary(page)) { - freed++; - if (!truncate_op) { - if (unlikely(hugetlb_unreserve_pages(inode, + +#ifdef CONFIG_ASCEND_SHARE_POOL + if (HPageTemporary(page) != 0) { + unlock_page(page); + if (!truncate_op) + mutex_unlock(&hugetlb_fault_mutex_table[hash]); + continue; + } +#endif + freed++; + if (!truncate_op) { + if (unlikely(hugetlb_unreserve_pages(inode, index, index + 1, 1))) hugetlb_fix_reserve_counts(inode); - } }
unlock_page(page); @@ -1061,8 +1068,12 @@ static int hugetlbfs_error_remove_page(struct address_space *mapping, pgoff_t index = page->index;
remove_huge_page(page); +#ifdef CONFIG_ASCEND_SHARE_POOL if (!HPageTemporary(page) && unlikely(hugetlb_unreserve_pages(inode, index, index + 1, 1))) +#else + if (unlikely(hugetlb_unreserve_pages(inode, index, index + 1, 1))) +#endif hugetlb_fix_reserve_counts(inode);
return 0;