Commit 862f7f65 authored by Miaohe Lin's avatar Miaohe Lin Committed by Andrew Morton

hugetlb_cgroup: remove unneeded nr_pages > 0 check

Patch series "A few cleanup patches for hugetlb_cgroup", v2.

This series contains a few cleaup patches to remove unneeded check, use
helper macro, remove unneeded return value and so on.  More details can be
found in the respective changelogs.


This patch (of 5):

When code reaches here, nr_pages must be > 0. Remove unneeded nr_pages > 0
check to simplify the code.

Link: https://lkml.kernel.org/r/20220729080106.12752-1-linmiaohe@huawei.com
Link: https://lkml.kernel.org/r/20220729080106.12752-2-linmiaohe@huawei.comSigned-off-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
Reviewed-by: default avatarMina Almasry <almasrymina@google.com>
Cc: Mike Kravetz <mike.kravetz@oracle.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 6f83d6c7
...@@ -442,7 +442,7 @@ void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv, ...@@ -442,7 +442,7 @@ void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv,
if (hugetlb_cgroup_disabled() || !resv || !rg || !nr_pages) if (hugetlb_cgroup_disabled() || !resv || !rg || !nr_pages)
return; return;
if (rg->reservation_counter && resv->pages_per_hpage && nr_pages > 0 && if (rg->reservation_counter && resv->pages_per_hpage &&
!resv->reservation_counter) { !resv->reservation_counter) {
page_counter_uncharge(rg->reservation_counter, page_counter_uncharge(rg->reservation_counter,
nr_pages * resv->pages_per_hpage); nr_pages * resv->pages_per_hpage);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment