From patchwork Fri Nov 5 20:41:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12605641 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DB954C433F5 for ; Fri, 5 Nov 2021 20:42:00 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id AD82061262 for ; Fri, 5 Nov 2021 20:42:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org AD82061262 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id 51DAC940087; Fri, 5 Nov 2021 16:42:00 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4CCEC94007C; Fri, 5 Nov 2021 16:42:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3E294940087; Fri, 5 Nov 2021 16:42:00 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0190.hostedemail.com [216.40.44.190]) by kanga.kvack.org (Postfix) with ESMTP id 2F6BF94007C for ; Fri, 5 Nov 2021 16:42:00 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E86D482499A8 for ; Fri, 5 Nov 2021 20:41:59 +0000 (UTC) X-FDA: 78776048358.18.88B4C5D Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf29.hostedemail.com (Postfix) with ESMTP id 814DB900025D for ; Fri, 5 Nov 2021 20:41:59 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 9A86A6126A; Fri, 5 Nov 2021 20:41:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1636144918; bh=AQysa+n5ZPxXt7NfGtd1LvpmRCrYopYheHGaUrrks8I=; h=Date:From:To:Subject:In-Reply-To:From; b=qmJckTD67WT0N1oxAvBYG0AqWJmNEfq+fzKf6aktPbAB0ONQWUtBr+6luxQX4j0Dw 2lEm3p85qu43OEElOIE3l8wnwOSpgMUrYHNTVIyTbOVzkS9dQL1pBSey57rKiRK+Q0 kK7S6ynN275bEDwSZF7ZoVs6a/AlaQ5/WSqa4AWo= Date: Fri, 05 Nov 2021 13:41:58 -0700 From: Andrew Morton To: akpm@linux-foundation.org, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, mhocko@kernel.org, mike.kravetz@oracle.com, mm-commits@vger.kernel.org, torvalds@linux-foundation.org Subject: [patch 140/262] hugetlb: remove redundant validation in has_same_uncharge_info() Message-ID: <20211105204158.dBpgUQHuO%akpm@linux-foundation.org> In-Reply-To: <20211105133408.cccbb98b71a77d5e8430aba1@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 814DB900025D X-Stat-Signature: yhgfgq55i9rdp64idzr7ak74zigw65ge Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=qmJckTD6; dmarc=none; spf=pass (imf29.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-HE-Tag: 1636144919-508267 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: From: Baolin Wang Subject: hugetlb: remove redundant validation in has_same_uncharge_info() 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. Link: https://lkml.kernel.org/r/97fc68d3f8d34f63c204645e10d7a718997e50b7.1634797639.git.baolin.wang@linux.alibaba.com Signed-off-by: Baolin Wang Reviewed-by: Mike Kravetz Cc: Michal Hocko Signed-off-by: Andrew Morton --- mm/hugetlb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/mm/hugetlb.c~hugetlb-remove-redundant-validation-in-has_same_uncharge_info +++ a/mm/hugetlb.c @@ -332,8 +332,7 @@ static bool has_same_uncharge_info(struc 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