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 A464DC433EF for ; Fri, 13 May 2022 08:41:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ED5096B0073; Fri, 13 May 2022 04:41:36 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E5D546B0075; Fri, 13 May 2022 04:41:36 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CD6316B0078; Fri, 13 May 2022 04:41:36 -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 B98FB6B0073 for ; Fri, 13 May 2022 04:41:36 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 83367804E6 for ; Fri, 13 May 2022 08:41:36 +0000 (UTC) X-FDA: 79460076192.27.BA60363 Received: from mail-pj1-f53.google.com (mail-pj1-f53.google.com [209.85.216.53]) by imf13.hostedemail.com (Postfix) with ESMTP id C7C6920004 for ; Fri, 13 May 2022 08:41:16 +0000 (UTC) Received: by mail-pj1-f53.google.com with SMTP id l7-20020a17090aaa8700b001dd1a5b9965so7192916pjq.2 for ; Fri, 13 May 2022 01:41:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=80smbfsEHbUPCVxIaatQJ7o5/6SvzQd+/0tsPWryTUc=; b=NGX8mUqWRStuTVVcxiA/14gdjYu4w6jDywygRSse2Al0R6vhKjF7ejd4bcd+TWA+NV 5sE7jkEKPxoXtTxkVMR4FUAg01YByNULcJavkl/EVRq9aP0Ip5hDwH+nG4PCljuM3z/4 aTxWLTcQX60tDn0jyPYUWx8y1bEIww8iG9VrKL3XZXLKyS/jsvPgrEiPUKVK2I1Jp1U4 s264uWSJBzFF0nsTBcprvsQB1DAKBErnw/WMFpTFbxOZp469QHWu27Av+dTXg6o2sLfn fqW1mNcyhSTprs8HjPzRGCyYHR272nKed8BCfi75Q+wJFhCU1iQVTyF8Tv9G1X5xPKMj lOkg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=80smbfsEHbUPCVxIaatQJ7o5/6SvzQd+/0tsPWryTUc=; b=tM+deLP+Im7/QGUQOEYFxocEsgvOcPKR5/ukRIBk0qLGj+mNKwVCyuDB8dfNVnV7zk KIuE1dog5pdbmWKF9wkbDajHaTrIFLZ8C6qGYShoBmB53VcCDkVkc3jw4vRCi1e0I/Jd iMdcmXbU7VSyYqyu34iXrZBQfet6bkqvKNF7B1u/Q4LhV9+nib6UkKsy1795zUqlkIq4 6Z6j1qkUo4JxFEnZ4lQH0fsXNirpKXWFbUeycpxGoBBUQUb8PYccpHm/GjMjc0hurZJt 7zQBVIySNrwj3C8J97V4//OmhlBFlSqIvFVqy5EFv8/wPFqYhHL7/s7ZWERpMaH0gjT7 kDFw== X-Gm-Message-State: AOAM532A6spMkM+YVcct9Gojp7nNcnJ7qEP8wmHNYoiDfFRBNVnPvOh/ DPOvbwp9WLXVINsWJrMnZm0hCQ== X-Google-Smtp-Source: ABdhPJzoFuP/7OVqOZRryESPw/ak0ZY19Mcm83pECHoY4nzg8+Terp/RHyOAw5R8D2Fqh8h12yr/ug== X-Received: by 2002:a17:90a:e641:b0:1da:43b8:95b7 with SMTP id ep1-20020a17090ae64100b001da43b895b7mr3807596pjb.180.1652431293805; Fri, 13 May 2022 01:41:33 -0700 (PDT) Received: from localhost ([139.177.225.250]) by smtp.gmail.com with ESMTPSA id w1-20020a62c701000000b0050dc762815asm1173106pfg.52.2022.05.13.01.41.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 01:41:33 -0700 (PDT) Date: Fri, 13 May 2022 16:41:20 +0800 From: Muchun Song To: Mel Gorman Cc: Nicolas Saenz Julienne , Marcelo Tosatti , Vlastimil Babka , Michal Hocko , LKML , Linux-MM Subject: Re: [PATCH 1/6] mm/page_alloc: Add page->buddy_list and page->pcp_list Message-ID: References: <20220509130805.20335-1-mgorman@techsingularity.net> <20220509130805.20335-2-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220509130805.20335-2-mgorman@techsingularity.net> Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=NGX8mUqW; spf=pass (imf13.hostedemail.com: domain of songmuchun@bytedance.com designates 209.85.216.53 as permitted sender) smtp.mailfrom=songmuchun@bytedance.com; dmarc=pass (policy=none) header.from=bytedance.com X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: C7C6920004 X-Stat-Signature: u9sfjudc3bjzdfiaq3ps96ck55e57gjp X-HE-Tag: 1652431276-136940 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 Mon, May 09, 2022 at 02:08:00PM +0100, Mel Gorman wrote: > The page allocator uses page->lru for storing pages on either buddy or > PCP lists. Create page->buddy_list and page->pcp_list as a union with > page->lru. This is simply to clarify what type of list a page is on > in the page allocator. > > No functional change intended. > Nice cleanup for me. > Signed-off-by: Mel Gorman > --- > include/linux/mm_types.h | 5 +++++ > mm/page_alloc.c | 18 +++++++++--------- > 2 files changed, 14 insertions(+), 9 deletions(-) > > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > index 8834e38c06a4..a2782e8af307 100644 > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -87,6 +87,7 @@ struct page { > */ > union { > struct list_head lru; > + > /* Or, for the Unevictable "LRU list" slot */ > struct { > /* Always even, to negate PageTail */ > @@ -94,6 +95,10 @@ struct page { > /* Count page's or folio's mlocks */ > unsigned int mlock_count; > }; > + > + /* Or, free page */ > + struct list_head buddy_list; > + struct list_head pcp_list; > }; Since you have clarified "lru" member, should we go further? Like union "index" to "pcp_migratetype" and "private" to "order" since buddy allocator reuses "index" and "private" as well. My initial idea is as follows, it is more clear for me, what do you think? diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h index dbfd892ac96a..644349a5f901 100644 --- a/include/linux/mm_types.h +++ b/include/linux/mm_types.h @@ -107,6 +107,15 @@ struct page { */ unsigned long private; }; + struct { /* pages manipulated by buddy allocator */ + union { + struct list_head buddy_list; + struct list_head pcp_list; + }; + unsigned long mapping_pad; /* Not used */ + unsigned long pcp_migratetype; + unsigned long order; + }; struct { /* page_pool used by netstack */ /** * @pp_magic: magic value to avoid recycling non