Message ID | 20220818082748.40021-1-zhengqi.arch@bytedance.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 81F4DC00140 for <linux-mm@archiver.kernel.org>; Thu, 18 Aug 2022 10:11:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF1678D0001; Thu, 18 Aug 2022 06:11:41 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DA1446B0075; Thu, 18 Aug 2022 06:11:41 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C68988D0001; Thu, 18 Aug 2022 06:11:41 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B41BF6B0074 for <linux-mm@kvack.org>; Thu, 18 Aug 2022 06:11:41 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 85A311C7258 for <linux-mm@kvack.org>; Thu, 18 Aug 2022 10:11:41 +0000 (UTC) X-FDA: 79812296802.25.8A2D08A Received: from mail-io1-f46.google.com (mail-io1-f46.google.com [209.85.166.46]) by imf07.hostedemail.com (Postfix) with ESMTP id 8021343551 for <linux-mm@kvack.org>; Thu, 18 Aug 2022 10:07:47 +0000 (UTC) Received: by mail-io1-f46.google.com with SMTP id b142so717125iof.10 for <linux-mm@kvack.org>; Thu, 18 Aug 2022 03:07:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=EmRObFLBYlo/QTIFOmKwyNbAwrACrTIX9zYb5ZW9YpQ=; b=ZnFbnLt+FmH/S92YpyR3SthYc2Q1rZs+3KQgNhRfnSuREc+qoFxX6gtyU3tRPSBXlQ ywvhMZRNfJw2m16v1N8UNmBzIWu/K+ar8pEtCvgXYfOcrzWZHezwXsdko0iBBBoec0zG 2u9/hXyGsaaJKrnqpEoaHCSbauNEoaUB7ms8jnTIuikzM77pfGuqn58nDXiXAXYAHmSA 0gGj3P9rJo5p8/gVuDiQxalHRsb8Uqe2uzB54CoE1OUtP+L2Gc2deo27RhrgntpbUspc NpuDf2+WvZ443nhrYEjvcwDb0+3zB/lJaOyqZahjtFwmaI8KVmdu7BGxOaowdS7P1QeA l69Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=EmRObFLBYlo/QTIFOmKwyNbAwrACrTIX9zYb5ZW9YpQ=; b=ttT9vr5xCVQU2SV8OmVOIgfnapbYhUEXi7yfoXK/HqTEsA+dY7+HBcuRlAKn+YcWIv mmRMY/n8uoQNd0foNffluS5BUHjhuHAxc0lfRgzXJ/B4xeXrpX7vWj506R49mbwUsRh3 HldqVlnCF54dVbrqsSNhUmZ+FC/QUvEOHjtZB+gqcLRMxw+hq/4wUT85mDYgNcBbAqSF +V4S0BCUl8bWIiW6ES9uKnzv8bFGfgTDgNxx2W3wfmquuYOmT0U2ZF8bVdYEKHxnWYQX ziGJ6gbRcPkGgZQShgE4xf/TT/kgEC40BeqZMUT2xWTff1ZzRiffhDKBgkZlpQTF1+Go lwwA== X-Gm-Message-State: ACgBeo0gS2TfRnfaSFZJYQIUla38CdKnm60Ec3vsvUbCPFJzFahiE0jQ qHDUvWGS4+1W0B4A/5QohbZOXzCYkgn41g== X-Google-Smtp-Source: AA6agR5DTxmJDTqZ0OLuFeuGqsM5XgRBq8GRImtxLazznsQnmAtoenqlD5ZooU2acz1nq4rvKV7k/w== X-Received: by 2002:a63:82c6:0:b0:41c:d253:a446 with SMTP id w189-20020a6382c6000000b0041cd253a446mr1623984pgd.125.1660811275880; Thu, 18 Aug 2022 01:27:55 -0700 (PDT) Received: from C02DW0BEMD6R.bytedance.net ([139.177.225.255]) by smtp.gmail.com with ESMTPSA id 83-20020a621756000000b0052b84ca900csm971920pfx.62.2022.08.18.01.27.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 18 Aug 2022 01:27:55 -0700 (PDT) From: Qi Zheng <zhengqi.arch@bytedance.com> To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Qi Zheng <zhengqi.arch@bytedance.com> Subject: [PATCH] mm: thp: remove redundant pgtable check in set_huge_zero_page() Date: Thu, 18 Aug 2022 16:27:48 +0800 Message-Id: <20220818082748.40021-1-zhengqi.arch@bytedance.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1660817272; a=rsa-sha256; cv=none; b=zS9WdvtQcx19WXxgxAQOC0TVPztvGKKaX7SOkfPF6TGIkI+xdAPd5/Wr4psf5xueA7iZpB N4TP5QYCWasmHc2R2GTihHoOW+jJG0Mxr8Ya5mozXlruNApqgqoU0QEs0LDFSvqs+su/E8 wrZXatNZwFh/6A6eiAJzJmubKwc7K7k= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=ZnFbnLt+; spf=pass (imf07.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.166.46 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1660817272; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=EmRObFLBYlo/QTIFOmKwyNbAwrACrTIX9zYb5ZW9YpQ=; b=jV7l5FsRS24X9WEn18Hq8chSNsoCCpH3Ffhcsb0OlGEzJYSQs0OZlT1oJUMFxNnD5jqMwq QEWiY3jLFTHqPtWC3N4clCnFUrLd2sFalJPhNdFadppfcDRG0v28Rj6JW06s5XK0eniqyO SdYvuysrx1a1ddzlkvfYEh1/WI6fZqw= X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 8021343551 X-Rspam-User: X-Stat-Signature: gkpg5dw56fiy5k6619u6bjm5b7yqqsot Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=ZnFbnLt+; spf=pass (imf07.hostedemail.com: domain of zhengqi.arch@bytedance.com designates 209.85.166.46 as permitted sender) smtp.mailfrom=zhengqi.arch@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-HE-Tag: 1660817267-136520 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: <linux-mm.kvack.org> |
Series |
mm: thp: remove redundant pgtable check in set_huge_zero_page()
|
expand
|
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 83c47a989260..655da0b4fea0 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -770,8 +770,7 @@ static void set_huge_zero_page(pgtable_t pgtable, struct mm_struct *mm, return; entry = mk_pmd(zero_page, vma->vm_page_prot); entry = pmd_mkhuge(entry); - if (pgtable) - pgtable_trans_huge_deposit(mm, pmd, pgtable); + pgtable_trans_huge_deposit(mm, pmd, pgtable); set_pmd_at(mm, haddr, pmd, entry); mm_inc_nr_ptes(mm); }
When the pgtable is NULL in the set_huge_zero_page(), we should not increment the count of PTE page table pages by calling mm_inc_nr_ptes(). Otherwise we may receive the following warning when the mm exits: BUG: non-zero pgtables_bytes on freeing mm Now we can't observe the above warning since only do_huge_pmd_anonymous_page() invokes set_huge_zero_page() and the pgtable can not be NULL. Therefore, instead of moving mm_inc_nr_ptes() to the non-NULL branch of pgtable, it is better to remove the redundant pgtable check directly. Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com> --- mm/huge_memory.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)