linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: akpm@linux-foundation.org, mike.kravetz@oracle.com
Cc: mhocko@kernel.org, baolin.wang@linux.alibaba.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] hugetlb: Remove redundant validation in has_same_uncharge_info()
Date: Thu, 21 Oct 2021 14:31:18 +0800	[thread overview]
Message-ID: <97fc68d3f8d34f63c204645e10d7a718997e50b7.1634797639.git.baolin.wang@linux.alibaba.com> (raw)
In-Reply-To: <cover.1634797639.git.baolin.wang@linux.alibaba.com>
In-Reply-To: <cover.1634797639.git.baolin.wang@linux.alibaba.com>

The callers of has_same_uncharge_info() has accessed the original file_region
and new file_region, and they are impossible to be NULL now. So we can remove
the file_region validation in has_same_uncharge_info() to simplify the code.

Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
 mm/hugetlb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 8902b07..5922629 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -333,8 +333,7 @@ static bool has_same_uncharge_info(struct file_region *rg,
 				   struct file_region *org)
 {
 #ifdef CONFIG_CGROUP_HUGETLB
-	return rg && org &&
-	       rg->reservation_counter == org->reservation_counter &&
+	return rg->reservation_counter == org->reservation_counter &&
 	       rg->css == org->css;
 
 #else
-- 
1.8.3.1


  parent reply	other threads:[~2021-10-21  6:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-21  6:31 [PATCH 0/4] Some cleanups and improvements for hugetlb Baolin Wang
2021-10-21  6:31 ` [PATCH 1/4] hugetlb_cgroup: Remove unused hugetlb_cgroup_from_counter macro Baolin Wang
2021-10-22 20:16   ` Mike Kravetz
2021-10-21  6:31 ` [PATCH 2/4] hugetlb: Replace the obsolete hugetlb_instantiation_mutex in the comments Baolin Wang
2021-10-22 20:44   ` Mike Kravetz
2021-10-21  6:31 ` Baolin Wang [this message]
2021-10-22 21:04   ` [PATCH 3/4] hugetlb: Remove redundant validation in has_same_uncharge_info() Mike Kravetz
2021-10-21  6:31 ` [PATCH 4/4] hugetlb: Remove redundant VM_BUG_ON() in add_reservation_in_range() Baolin Wang
2021-10-22 23:57   ` Mike Kravetz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=97fc68d3f8d34f63c204645e10d7a718997e50b7.1634797639.git.baolin.wang@linux.alibaba.com \
    --to=baolin.wang@linux.alibaba.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=mike.kravetz@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).