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=-10.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS 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 EC171C47094 for ; Mon, 7 Jun 2021 23:10:14 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 73C25610C7 for ; Mon, 7 Jun 2021 23:10:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 73C25610C7 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linux-foundation.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 8AE776B0036; Mon, 7 Jun 2021 19:10:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 85E976B006E; Mon, 7 Jun 2021 19:10:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 74D496B0070; Mon, 7 Jun 2021 19:10:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0056.hostedemail.com [216.40.44.56]) by kanga.kvack.org (Postfix) with ESMTP id 43B8E6B0036 for ; Mon, 7 Jun 2021 19:10:13 -0400 (EDT) Received: from smtpin24.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id D3FD91AB54 for ; Mon, 7 Jun 2021 23:10:12 +0000 (UTC) X-FDA: 78228473064.24.5A3605A Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf17.hostedemail.com (Postfix) with ESMTP id 6762940002C1 for ; Mon, 7 Jun 2021 23:10:10 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 4A0A860C3E; Mon, 7 Jun 2021 23:10:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1623107411; bh=9UuCN+TnLjTrMeiN8mN4PXlQmkc7yNBRa8Ows9g7YbA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ulg7njePPNVdiIQya2C8UglI1v15Su5q3iMtCmHB6wIw7/3pU7BzlF9U2stDWalIU ie+6/oB5j8Nb0FVJP/iz5rAsnsEhJVKXwXEulZzSYjBLY54vo34RJrQiMIw6pCnb74 eNJUX9vAs3zPZEcVxS2Ml87diJiHh8GOICbrQjug= Date: Mon, 7 Jun 2021 16:10:10 -0700 From: Andrew Morton To: Miaohe Lin Cc: , , , Subject: Re: [PATCH 1/2] mm/zbud: reuse unbuddied[0] as buddied in zbud_pool Message-Id: <20210607161010.94168ddc8128da6af1e45cea@linux-foundation.org> In-Reply-To: <20210605075141.1359969-2-linmiaohe@huawei.com> References: <20210605075141.1359969-1-linmiaohe@huawei.com> <20210605075141.1359969-2-linmiaohe@huawei.com> X-Mailer: Sylpheed 3.5.1 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=ulg7njeP; dmarc=none; spf=pass (imf17.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Rspamd-Server: rspam02 X-Stat-Signature: kjpj5s4iznow4ndf47nu7h74zxuue6q1 X-Rspamd-Queue-Id: 6762940002C1 X-HE-Tag: 1623107410-797305 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 Sat, 5 Jun 2021 15:51:40 +0800 Miaohe Lin wrote: > Since commit 9d8c5b5284e4 ("mm: zbud: fix condition check on allocation > size"), zbud_pool.unbuddied[0] is always unused. We can reuse it as buddied > field to save some possible memory. > > ... > > --- a/mm/zbud.c > +++ b/mm/zbud.c > @@ -96,7 +96,7 @@ > struct zbud_pool { > spinlock_t lock; > struct list_head unbuddied[NCHUNKS]; > - struct list_head buddied; > +#define buddied unbuddied[0] > struct list_head lru; > u64 pages_nr; > const struct zbud_ops *ops; That looks a bit hacky. Can we at least have a comment explaining what's going on? Would it be better to implement this with a union, rather than a #define?