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 X-Spam-Level: X-Spam-Status: No, score=-15.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 77844C433B4 for ; Wed, 12 May 2021 02:02:30 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id CF1F161166 for ; Wed, 12 May 2021 02:02:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CF1F161166 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id E8BF26B0036; Tue, 11 May 2021 22:02:28 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E62EE6B006E; Tue, 11 May 2021 22:02:28 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D29FF6B0070; Tue, 11 May 2021 22:02:28 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0133.hostedemail.com [216.40.44.133]) by kanga.kvack.org (Postfix) with ESMTP id B6D996B0036 for ; Tue, 11 May 2021 22:02:28 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6EB8C4DDC for ; Wed, 12 May 2021 02:02:28 +0000 (UTC) X-FDA: 78130929576.15.E9650AD Received: from szxga04-in.huawei.com (szxga04-in.huawei.com [45.249.212.190]) by imf09.hostedemail.com (Postfix) with ESMTP id 508EC6000112 for ; Wed, 12 May 2021 02:02:16 +0000 (UTC) Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FfydK2cnszmg9n; Wed, 12 May 2021 09:59:01 +0800 (CST) Received: from [10.174.176.232] (10.174.176.232) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Wed, 12 May 2021 10:02:16 +0800 Subject: Re: [PATCH v3 2/5] mm/huge_memory.c: use page->deferred_list To: Matthew Wilcox CC: , , , , , , , , , , , , , , , References: <20210511134857.1581273-1-linmiaohe@huawei.com> <20210511134857.1581273-3-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: Date: Wed, 12 May 2021 10:02:16 +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.176.232] X-CFilter-Loop: Reflected Authentication-Results: imf09.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=huawei.com; spf=pass (imf09.hostedemail.com: domain of linmiaohe@huawei.com designates 45.249.212.190 as permitted sender) smtp.mailfrom=linmiaohe@huawei.com X-Stat-Signature: akxxijko74zgpws5e64a9s6mh9i6tow8 X-Rspamd-Queue-Id: 508EC6000112 X-Rspamd-Server: rspam02 Received-SPF: none (huawei.com>: No applicable sender policy available) receiver=imf09; identity=mailfrom; envelope-from=""; helo=szxga04-in.huawei.com; client-ip=45.249.212.190 X-HE-DKIM-Result: none/none X-HE-Tag: 1620784936-129189 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 2021/5/12 7:03, Matthew Wilcox wrote: > On Tue, May 11, 2021 at 09:48:54PM +0800, Miaohe Lin wrote: >> Now that we can represent the location of ->deferred_list instead of >> ->mapping + ->index, make use of it to improve readability. >> >> Reviewed-by: Yang Shi >> Reviewed-by: David Hildenbrand >> Signed-off-by: Miaohe Lin >> --- >> mm/huge_memory.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/mm/huge_memory.c b/mm/huge_memory.c >> index 63ed6b25deaa..76ca1eb2a223 100644 >> --- a/mm/huge_memory.c >> +++ b/mm/huge_memory.c >> @@ -2868,7 +2868,7 @@ static unsigned long deferred_split_scan(struct shrinker *shrink, >> spin_lock_irqsave(&ds_queue->split_queue_lock, flags); >> /* Take pin on all head pages to avoid freeing them under us */ >> list_for_each_safe(pos, next, &ds_queue->split_queue) { >> - page = list_entry((void *)pos, struct page, mapping); >> + page = list_entry((void *)pos, struct page, deferred_list); >> page = compound_head(page); > > This is an equivalent transformation, but it doesn't really go far > enough. I think you want something like this: > > struct page *page, *next; > > list_for_each_entry_safe(page, next, &ds_queue->split_queue, > deferred_list) { > struct page *head = page - 1; > ... then use head throughout ... > } > Many thanks for your time and reminder. list_for_each_entry_safe is equivalent to list_for_each_safe + list_entry and there is many places using list_for_each_safe + list_entry, so I think it's ok to keep the code as it is. Thanks again. :) > . >