Message ID | 20220628132835.8925-16-linmiaohe@huawei.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 CDE64C43334 for <linux-mm@archiver.kernel.org>; Tue, 28 Jun 2022 13:29:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 646E08E0010; Tue, 28 Jun 2022 09:28:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 556588E000D; Tue, 28 Jun 2022 09:28:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1B18E8E0010; Tue, 28 Jun 2022 09:28:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D13B68E000D for <linux-mm@kvack.org>; Tue, 28 Jun 2022 09:28:50 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 38A2532E68 for <linux-mm@kvack.org>; Tue, 28 Jun 2022 13:28:50 +0000 (UTC) X-FDA: 79627724820.16.A7C0C51 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf13.hostedemail.com (Postfix) with ESMTP id 2C7712003C for <linux-mm@kvack.org>; Tue, 28 Jun 2022 13:28:48 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4LXQNv5sP8zkWYD; Tue, 28 Jun 2022 21:26:55 +0800 (CST) Received: from huawei.com (10.175.124.27) by canpemm500002.china.huawei.com (7.192.104.244) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Tue, 28 Jun 2022 21:28:45 +0800 From: Miaohe Lin <linmiaohe@huawei.com> To: <akpm@linux-foundation.org> CC: <shy828301@gmail.com>, <willy@infradead.org>, <zokeefe@google.com>, <songmuchun@bytedance.com>, <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>, <linmiaohe@huawei.com> Subject: [PATCH v2 15/16] mm/huge_memory: comment the subtly logic in __split_huge_pmd Date: Tue, 28 Jun 2022 21:28:34 +0800 Message-ID: <20220628132835.8925-16-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220628132835.8925-1-linmiaohe@huawei.com> References: <20220628132835.8925-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To canpemm500002.china.huawei.com (7.192.104.244) X-CFilter-Loop: Reflected ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656422929; a=rsa-sha256; cv=none; b=Qf6kyz/fpcUvNbVF3gYhPZNthG2kFwkReLhDYdqn53n0p+A06XeW3zievdd/oeKrd+nEtN bJ3tXT+OOQ6wS6qJqO7C7TFmbVb7b6LC1L+0VaqyF6ZmkTpJvsscZvTJAEJTF4bklPUHxG ap63BxrF+7GiHICPMgFScU9m3bWFOHk= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656422929; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=AQfxt4l5emHrLmAWIZ5cUt9orANIm+/V1mH/gXdu2oU=; b=4Dn3HFNW724GBuGNFJoXNJYitmkkqlSr1q8KNS0Cpw4IuGqGkUVeCS2c/HBl7GwUH38ow7 RcmNEeJRPTHcPb2VSViWna367ls0mtL3cOirJru2V4fyGp4CKhpFOfLQ/HV1rK0BZgMhUt 29I+NvCjGc/jopOBKLDCVKD8bayI5Ss= X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 2C7712003C Authentication-Results: imf13.hostedemail.com; dkim=none; spf=pass (imf13.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: X-Stat-Signature: wyorpb464zttj1nb6co4nkkpnugdxyzn X-HE-Tag: 1656422928-129616 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 |
A few cleanup patches for huge_memory
|
expand
|
diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 36570d800f21..1d32349a95f4 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2335,6 +2335,10 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, if (pmd_trans_huge(*pmd) || pmd_devmap(*pmd) || is_pmd_migration_entry(*pmd)) { + /* + * It's safe to call pmd_page when folio is set because it's + * guaranteed that pmd is present. + */ if (folio && folio != page_folio(pmd_page(*pmd))) goto out; __split_huge_pmd_locked(vma, pmd, range.start, freeze);
It's dangerous and wrong to call page_folio(pmd_page(*pmd)) when pmd isn't present. But the caller guarantees pmd is present when folio is set. So we should be safe here. Add comment to make it clear. Signed-off-by: Miaohe Lin <linmiaohe@huawei.com> --- mm/huge_memory.c | 4 ++++ 1 file changed, 4 insertions(+)