Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp158822pxy; Wed, 28 Apr 2021 01:24:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz4ZWaLOdqZu475OxuCFd1vePut1Jphusfv6SURIVEe4Unj58k9Cx01AenYLVNYfAUzE/qu X-Received: by 2002:a17:90a:cc11:: with SMTP id b17mr2892528pju.119.1619598277949; Wed, 28 Apr 2021 01:24:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619598277; cv=none; d=google.com; s=arc-20160816; b=XrKVsMk29xuSzps/jA1Z4Qp0pucnoCwesKtGWfhAKt5gk6jcfc+4rsxQe2MOpmO5Ou xQSkHqwZF/01d8P7+ZPvUXVt2xQwa+WvuZOiqr6mHuaB1cpkmZQkXgAHtxa+3KhSHa94 LgSoN3ks75FMhG45Xv21y8kpM3oIiVfeShosTIOBtcPmwPT6HLQoVsnvvaXfsEFP8Yw3 0VEWkTKOWLfPV2D3yXtDSgs1BP3vDA48ysn72nVvl9oJ56ymeeFKaWno0+7nluOij3EX 7O0RxRLPvYOxAKgQKFsdy9Qs/zjpU/wgv1gIe+HHEZrJ8gG/Sy0LvsE69YlnRcUV57vy WURw== 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=LWiXzkmuMi/hHkoONe5e9/1xiVqIe5k+8sN9lgnHY6c=; b=Z32VBUTilgU6wMyVt7GpY+WyRv75CcPAhfrDUCMp1WEaXayK3c643xDtRjWyqkLkGH Qe3rRrIuq3zVYl9axc8CQ4mfSHQQS9PukCetlgcSKOUZCxbnDqtPdVyK7Am02ZFo9i1V QoOIbklH/HdFlW9IzKn5wkz/FEo+Dq9qanjWy6pkFllF5WTA/DSoFKUFMLryKDwUGzfJ uvKyHgSwFJSBujOdh15CjEsoCrqRYD0bXte9x/A9BN1g1VDYE/BCVkIbq+ow1J8ItuNs sBWO01qyTcV2pF6hbEDEiDY1ClH5heWaE6ku8d+Du1ltImid3tAGwZQ95IFAWgROvFOS J24g== 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 l6si5961268pff.253.2021.04.28.01.24.25; Wed, 28 Apr 2021 01:24:37 -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 S237148AbhD1IYL (ORCPT + 99 others); Wed, 28 Apr 2021 04:24:11 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:17067 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236961AbhD1IYL (ORCPT ); Wed, 28 Apr 2021 04:24:11 -0400 Received: from DGGEMS411-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4FVWmS4HTwz16MPc; Wed, 28 Apr 2021 16:20:56 +0800 (CST) Received: from [10.174.176.174] (10.174.176.174) by DGGEMS411-HUB.china.huawei.com (10.3.19.211) with Microsoft SMTP Server id 14.3.498.0; Wed, 28 Apr 2021 16:23:22 +0800 Subject: Re: [PATCH 2/5] mm/huge_memory.c: use page->deferred_list To: Anshuman Khandual , CC: , , , , , , , , , , , , References: <20210427133214.2270207-1-linmiaohe@huawei.com> <20210427133214.2270207-3-linmiaohe@huawei.com> From: Miaohe Lin Message-ID: <2cda7d1a-d769-2635-24ce-928e33d6bfcc@huawei.com> Date: Wed, 28 Apr 2021 16:23:21 +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.174] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/4/28 11:07, Anshuman Khandual wrote: > > On 4/27/21 7:02 PM, Miaohe Lin wrote: >> Now that we can represent the location of ->deferred_list instead of >> ->mapping + ->index, make use of it to improve readability. > > Could you please explain how page->deferred_list and page->mapping > are interchangeable here ? It's because there is a union in struct page: union { struct { struct list_head lru; struct address_space *mapping; pgoff_t index; unsigned long private; }; struct { unsigned long _compound_pad_1; atomic_t hpage_pinned_refcount; struct list_head *deferred_list*; }; }; And initially there is no deferred_list and it's added via commit 66a6ffd2af42 ("mm: combine first three unions in struct page"). Also commit fa3015b7eed5 ("mm: use page->deferred_list") did the similar cleanup. Am I expected to add these to the commit log? Many thanks. > >> >> 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); >> if (get_page_unless_zero(page)) { >> list_move(page_deferred_list(page), &list); >> @@ -2883,7 +2883,7 @@ static unsigned long deferred_split_scan(struct shrinker *shrink, >> spin_unlock_irqrestore(&ds_queue->split_queue_lock, flags); >> >> list_for_each_safe(pos, next, &list) { >> - page = list_entry((void *)pos, struct page, mapping); >> + page = list_entry((void *)pos, struct page, deferred_list); >> if (!trylock_page(page)) >> goto next; >> /* split_huge_page() removes page from list on success */ >> > . >