From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 39C77C43334 for ; Sat, 25 Jun 2022 03:32:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A3A298E028C; Fri, 24 Jun 2022 23:32:35 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9E9CF8E0287; Fri, 24 Jun 2022 23:32:35 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8D8CB8E028C; Fri, 24 Jun 2022 23:32:35 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 7A4DD8E0287 for ; Fri, 24 Jun 2022 23:32:35 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 4E8DB6012B for ; Sat, 25 Jun 2022 03:32:35 +0000 (UTC) X-FDA: 79615335870.08.BE938B7 Received: from szxga03-in.huawei.com (szxga03-in.huawei.com [45.249.212.189]) by imf06.hostedemail.com (Postfix) with ESMTP id 6E90E180012 for ; Sat, 25 Jun 2022 03:32:33 +0000 (UTC) Received: from canpemm500002.china.huawei.com (unknown [172.30.72.53]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4LVKKG1jXRzDsQD; Sat, 25 Jun 2022 11:31:30 +0800 (CST) Received: from [10.174.177.76] (10.174.177.76) 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; Sat, 25 Jun 2022 11:32:05 +0800 Subject: Re: [PATCH 03/16] mm/huge_memory: fix comment of __pud_trans_huge_lock To: Matthew Wilcox CC: , , , , References: <20220622170627.19786-1-linmiaohe@huawei.com> <20220622170627.19786-4-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: Date: Sat, 25 Jun 2022 11:32:03 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.174.177.76] X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) 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=1656127954; 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=7MIwli3IBNr/3W1wSER/KCLkRQ/rVJ06UgWn9tkv8dA=; b=1tMquHtdYY8o49iU1dB64CAXG74JxbVPfut0FIVeLneFnx+5UcgBmF30EdEfDZyb+fjLRi rBD2eqsg5KuHYn7a/6RV8XM0OmIVUYBegGyonqVPNFtGnlYlqb+CoZlgHHWYVFtL87EJ5W a7S6A7m9tBIBsSSxCBkyIhrJrjAIW0g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1656127954; a=rsa-sha256; cv=none; b=OymGGDLmHx29blYe2vnPrd7zEh+Tf07ixtlQrcGyDqr+uh6Z+lsoxkJ7ydMHjmj4bXImz2 prKRgNBwNkivaRsLwdivjEc/2vUJ98xMrxQP6HU91VeqYzf5R4ONC8NBdbtAlr5H7oTwpg nB1YC6G5PY0uy+j648qX3nMNmBaJtNs= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspam-User: Authentication-Results: imf06.hostedemail.com; dkim=none; spf=pass (imf06.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.189 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com; dmarc=pass (policy=quarantine) header.from=huawei.com X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 6E90E180012 X-Stat-Signature: xj1qyende7747jyw3kt6omp4k736js8t X-HE-Tag: 1656127953-826020 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: On 2022/6/25 2:56, Matthew Wilcox wrote: > On Thu, Jun 23, 2022 at 01:06:14AM +0800, Miaohe Lin wrote: >> __pud_trans_huge_lock returns page table lock pointer if a given pud maps >> a thp instead of 'true' since introduced. Fix corresponding comments. > > I think the comments here are rather wasted. I think this comment > should be moved to pud_trans_huge_lock() and turned into kernel-doc > format. Do you mean something like below? If so, __pmd_trans_huge_lock might need to do the similar work? diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index ae3d8e2fd9e2..b73fe864de13 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -238,6 +238,12 @@ static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, else return NULL; } +/** + * Returns true if a given pud maps a thp, false otherwise. + * + * Note that if it returns true, this routine returns without unlocking page + * table lock. So callers must unlock it. + */ static inline spinlock_t *pud_trans_huge_lock(pud_t *pud, struct vm_area_struct *vma) { diff --git a/mm/huge_memory.c b/mm/huge_memory.c index eb2e4ecb76aa..ae4c2116be07 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -2006,12 +2006,6 @@ spinlock_t *__pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma) return NULL; } -/* - * Returns true if a given pud maps a thp, false otherwise. - * - * Note that if it returns true, this routine returns without unlocking page - * table lock. So callers must unlock it. - */ spinlock_t *__pud_trans_huge_lock(pud_t *pud, struct vm_area_struct *vma) { spinlock_t *ptl; Thanks! > >> Signed-off-by: Miaohe Lin >> --- >> mm/huge_memory.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >> index 83fb6c3442ff..a26580da8011 100644 >> --- a/mm/huge_memory.c >> +++ b/mm/huge_memory.c >> @@ -1903,10 +1903,10 @@ spinlock_t *__pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma) >> } >> >> /* >> - * Returns true if a given pud maps a thp, false otherwise. >> + * Returns page table lock pointer if a given pud maps a thp, NULL otherwise. >> * >> - * Note that if it returns true, this routine returns without unlocking page >> - * table lock. So callers must unlock it. >> + * Note that if it returns page table lock pointe, this routine returns without >> + * unlocking page table lock. So callers must unlock it. >> */ >> spinlock_t *__pud_trans_huge_lock(pud_t *pud, struct vm_area_struct *vma) >> { >> -- >> 2.23.0 >> > > . >