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.com Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> Reviewed-by: Mina Almasry <almasrymina@google.com> Cc: Mike Kravetz <mike.kravetz@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This commit is contained in:
parent
6f83d6c74e
commit
862f7f6581
|
@ -442,7 +442,7 @@ void hugetlb_cgroup_uncharge_file_region(struct resv_map *resv,
|
|||
if (hugetlb_cgroup_disabled() || !resv || !rg || !nr_pages)
|
||||
return;
|
||||
|
||||
if (rg->reservation_counter && resv->pages_per_hpage && nr_pages > 0 &&
|
||||
if (rg->reservation_counter && resv->pages_per_hpage &&
|
||||
!resv->reservation_counter) {
|
||||
page_counter_uncharge(rg->reservation_counter,
|
||||
nr_pages * resv->pages_per_hpage);
|
||||
|
|
Loading…
Reference in New Issue