Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1003978iob; Fri, 13 May 2022 19:18:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxGf+JZj1wPmaarGX8c3mjylcvP6WcMv/HrCrjjRTPfhMVYNL0e2xRh14ZF83iU5H30778p X-Received: by 2002:a5d:64e6:0:b0:20c:4f23:96fc with SMTP id g6-20020a5d64e6000000b0020c4f2396fcmr6112631wri.154.1652494688346; Fri, 13 May 2022 19:18:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652494688; cv=none; d=google.com; s=arc-20160816; b=Iriy/X02uU7WnEdrPt7r+KOm84Ig90MECcPHZ4y3WFaYjL2bJoUsiyqysds1oDBh9d 1YW3UpA/sTj7Rw4lt0QGpQZze9YR+bLEkvsZaVxgjhzBi1Mz06wtarPTmNqmEZHgMObJ 8zqk8FOFd/ZyGpzZL7NSIDrM23RDC/XXUAb7TJ3PCrH7jI7L+f04+iq6EGoT46CjoHBz tAb2hHEh8wzhAnXODWt7R/CgnTG2uugdqevz9V1uJvl0odFJSb/jQcOpzS0aqzy4XqC9 Hk4EdJWGaANefe4O1JpTw4INcoXGAItCtJ7d5S8DTRFQ+YJY8IVi28UWZwVMYdjX7ZKC 6WxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=80smbfsEHbUPCVxIaatQJ7o5/6SvzQd+/0tsPWryTUc=; b=Jkka3y76Je0ZIyTqM1+iJ6ZAqMsFYHfPARF7Tw4tyXMB5Opkgr5UbfcQqf9OSY6+jT xxDUdmIVFDdtiX9xsOwkt79UG8oejQt3XWoB9StN9dphdE2yW4Asc/PzIOauxqbEDERK scfvCONMTCPoUGgW/FrGN8YvH1sIJMIcusi1mTcwpY19iN/A75yZVtIp3PGSSs9sww8p C2vhjBS8ZbnitQhJC+TKi0Rwc9Y3KeF3CtC6tio+TqyAxS1J/f+YSOKJtrVOHPCMyeb3 ejv+0l9u3w10EdTd94mOiigx1v7vw3m5mSDImtZ6/qleYqapjkm7rMXyJMhgq4Db7r5k ydGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=NGX8mUqW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id x2-20020adfdcc2000000b00207a8c94092si3406103wrm.787.2022.05.13.19.18.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 19:18:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance-com.20210112.gappssmtp.com header.s=20210112 header.b=NGX8mUqW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8EDE54AF8DB; Fri, 13 May 2022 17:34:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378474AbiEMIlh (ORCPT + 99 others); Fri, 13 May 2022 04:41:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39372 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378317AbiEMIlf (ORCPT ); Fri, 13 May 2022 04:41:35 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 819065908B for ; Fri, 13 May 2022 01:41:34 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id t11-20020a17090ad50b00b001d95bf21996so10210401pju.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=tNbQetY1h6jYwCy792fYFgSaGMAxX/UIueUYvZ8imrK3jxV+HHDkAM254KhkFWgG/f ZCxhF6FM+axbKeKvTx5M6xPuSMBwW3Q8xLc3N9wNX4cCzhENtPfWh1lyc7y5lifVD211 sPAtJxF7px/+PWtcmooJaPfni6L0WRQz6SoO5gdhSV/dy/mIzYrqdTApXlJdLpcPg5pQ grB2V1FFHuWqi8zDmB3yECoowWpDbuMW7zMjLlS98Gfz1sSJLF1tBdhoXoDOMqPSBwJ0 rv25KD+e9QgaFQebQRSBk6PvKK9mMMZUEN93D8PhJqqsicmhEBblxx5uQj1aHsURammP 3e7A== X-Gm-Message-State: AOAM530S6vg7ChWMEzNur/icR7GpPSzXxnyX9ITrfwpAjvStH5wHahaO 6e4e2rlV6aIM+4+frq/PUXM9wdbZEs9/yw== 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> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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