Message ID | 20220704132201.14611-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 F1B08C433EF for <linux-mm@archiver.kernel.org>; Mon, 4 Jul 2022 13:22:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 24FA76B0087; Mon, 4 Jul 2022 09:22:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 146E26B0092; Mon, 4 Jul 2022 09:22:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DBE326B008A; Mon, 4 Jul 2022 09:22:22 -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 C0C246B0089 for <linux-mm@kvack.org>; Mon, 4 Jul 2022 09:22:22 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9AD1835775 for <linux-mm@kvack.org>; Mon, 4 Jul 2022 13:22:22 +0000 (UTC) X-FDA: 79649481324.05.CE83E95 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by imf26.hostedemail.com (Postfix) with ESMTP id ED371140032 for <linux-mm@kvack.org>; Mon, 4 Jul 2022 13:22:21 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Lc5wh0czfzTgXl; Mon, 4 Jul 2022 21:18:44 +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; Mon, 4 Jul 2022 21:22:18 +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 v3 15/16] mm/huge_memory: comment the subtly logic in __split_huge_pmd Date: Mon, 4 Jul 2022 21:22:00 +0800 Message-ID: <20220704132201.14611-16-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20220704132201.14611-1-linmiaohe@huawei.com> References: <20220704132201.14611-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-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1656940942; 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=mg2R5DOQszpgVAtqyADsl5YpS5w5+LE+visBbIAgLUg=; b=Ut1Y9ugXkSPnNredvZES9GoEoCZhZRA+3WtBjI1xUUH1qUMONMpSML03vr2m/p0oAiNnpE GIMu+LNQ7O12lEZk80eRHSlqMvCbcRNBg36KRuwcbQzl5Ok7gy6e+/PNRzwCVI9ICLeHOw 31ZfBMqY3IC0zwVtQwRXrnuw9WAGVLc= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656940942; a=rsa-sha256; cv=none; b=Wg8vQlnL5OWVlEVHfyecsv1UWNhJe0D5Elkz6/eTByjqCrD4ZWQ6OZi+niU5mvv4rbHieq geJ6jLGk7Z7+CcgGO2YKe3d5x1lRYaJ4qIgYvfA0FjIv03ZmrQRLqvzYCqwVZ/H2T5UnH7 Hg+UswjoLPbCk/934Na+1Pkpx9sxITc= Authentication-Results: imf26.hostedemail.com; dkim=none; dmarc=pass (policy=quarantine) header.from=huawei.com; spf=pass (imf26.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.188 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: ED371140032 X-Stat-Signature: yn8t5rpua7wtho3rwb1c36najqxgdzn9 X-Rspam-User: X-HE-Tag: 1656940941-981009 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 36f3fc2e7306..8380912b39fd 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2336,6 +2336,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(+)