Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4055806pxj; Tue, 11 May 2021 19:03:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzzNly8WCxvyIlm66h69auHRKarpJ1nrQNj5yUe+Y/vuCkmXuCTt7iOOG1Hk5krdNMkJYjp X-Received: by 2002:a05:6830:45a:: with SMTP id d26mr19837450otc.339.1620784999396; Tue, 11 May 2021 19:03:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620784999; cv=none; d=google.com; s=arc-20160816; b=t0yMzNVpXJGl1ElSOO1AMdxAHmjlqZJROzKb5kEzi3saYE6+Ok/cSjIoJJzZgvHXqh sqW/zQKyWoW/0KP60WhdfyMKm8P5s8DXg0Se1XyN+PVRAi5bYaxP4iznrsQs0DU43nu0 kcVuraAHtiDPPMa9SYYAG+aS5kL0ErCjej8QLjb2Bt3yK/uom1Hd+z5TlF5dRLvizHno QR23QWYXaLVEQjkZk5sDMWziO4X9/48tkBPF5PKjNInCCUBCc/HB78hGEF69cmfdKMOe WblNOGlaUTlCDzzgfo3DJIi3GvYrDQWZp7PBsudNb5xaCC9LRTzfG7WfPK/oMdQKkJKh q63w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=gD+FxO226oXLXCeK+yw6oZjoFS/udIz4GqSsPtQbx6U=; b=refguBgYG13N1loJ30H4aw2zes6IFRAqH3YrOJfLf1CaqLf6kEjGNmUZCw60+hbCtK h6cTPDxAPqBRxemMr7jbishH1YKSGZgYiBFFIZv57UnodimDabU7102JSjQNqkR7U1bq GG+TeDQ1KBwfPBc0fKk93jcYyIe5k+QM7/e+esPzQX8aLU5kebraebuCUmivTR2WMNF9 Uolqxuk0mqhKjD5PvUzBQ+I8WNYxrlfHDFnw878pnmSaPf9zVBaFeJJ/XafkKSRDO5va I9rVu6SkoIc6+p3V70KQU0p0vrWSbM92bbQRKML6sKZS9Ci1yPzolahxAQ+NQjM8A+xC 6y8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k8si19245851oic.37.2021.05.11.19.03.06; Tue, 11 May 2021 19:03:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230323AbhELCDc (ORCPT + 99 others); Tue, 11 May 2021 22:03:32 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2780 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230095AbhELCDc (ORCPT ); Tue, 11 May 2021 22:03:32 -0400 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. :) > . >