Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4554802pxj; Tue, 8 Jun 2021 17:52:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxByu6dyNyw1yJ5aD6xgQTDOwZIXqAucHF0gLtQ/BthjrAwJWmo2o7nuugGYdr2tVpqRjLA X-Received: by 2002:a17:906:a0a:: with SMTP id w10mr26333162ejf.416.1623199925316; Tue, 08 Jun 2021 17:52:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623199925; cv=none; d=google.com; s=arc-20160816; b=eqqladSFT6mLw+TzjWAC7Xykqq9gcQJA7Q9JvjTtJ5aYVqBIFpNyVTMcQF5lzMOlkh UJKt1+BwpAWBa48RWf7mCIM+Dd5Vd6cfVs7kfXs9D5e0rvV/VbZFLVx7zA4GZSnADLL2 IMp7wK+Pe8rmJvsxOGZvdn72YAgEvps4AEQNcljcHdhZpo2YoRMqiCtuAUMEB8R2k6Wa wHdjQUvfo4IvRYjS1Jv0gYLlWGMV2irs4rhA5oauQE9+OV+/V/G59nzjL4E8+HjCVng3 gW4Sks+q2Nnu2QzkbCXB23xWxp0cBcZMiIhDXnqTPzTvq5nBYNKRKmx6Fd+HJ52HZ0+d Ks1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=p78EjKWElj2+DgQUZ5tP3RdbXh4GxcDHkyL0dn7LxU0=; b=CTgBownDldBPJWv5cpZb6v9QtJIfGo2iLAhHiVmYkOJno1KzcwmGV9ySVzvdSKV9Qe BGoqFevfpaJLa7Lm29DxBhitNBf7cAycs47phqDXmqUJHjTZq+OaJAFzwsNyEcGfQ1Ow ZXp6+rTn/ri9zYz3S5jyfJNPvEgWyBT9fYKc/c8tD7HAdU/3eL40RobTUaTMTnKOR6Vx QU9mFdDCDksfzRoKAs3wF2H34jL2ujQZ37cnI/Mgzdgn2S+i6Ozp+3GEbs69rEfEMa+a 2tWSrLkwgxvDc9oQPIKh3OZ3kWvtnYeF5TjzJv5o1QzOUPQTxu25dS6d4v1yDG+4p5fn 9ZsQ== 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 h7si950918ejo.519.2021.06.08.17.51.42; Tue, 08 Jun 2021 17:52:05 -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 S232075AbhFHLsA (ORCPT + 99 others); Tue, 8 Jun 2021 07:48:00 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:8090 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232100AbhFHLr7 (ORCPT ); Tue, 8 Jun 2021 07:47:59 -0400 Received: from dggeme703-chm.china.huawei.com (unknown [172.30.72.56]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4FzpJz0p5SzYrl6; Tue, 8 Jun 2021 19:43:15 +0800 (CST) Received: from huawei.com (10.175.104.170) by dggeme703-chm.china.huawei.com (10.1.199.99) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2176.2; Tue, 8 Jun 2021 19:46:03 +0800 From: Miaohe Lin To: , , CC: , , Subject: [PATCH v2 1/2] mm/zbud: reuse unbuddied[0] as buddied in zbud_pool Date: Tue, 8 Jun 2021 19:45:14 +0800 Message-ID: <20210608114515.206992-2-linmiaohe@huawei.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20210608114515.206992-1-linmiaohe@huawei.com> References: <20210608114515.206992-1-linmiaohe@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.104.170] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggeme703-chm.china.huawei.com (10.1.199.99) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Signed-off-by: Miaohe Lin --- mm/zbud.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mm/zbud.c b/mm/zbud.c index a200121da400..78e80ca58869 100644 --- a/mm/zbud.c +++ b/mm/zbud.c @@ -95,8 +95,14 @@ */ struct zbud_pool { spinlock_t lock; - struct list_head unbuddied[NCHUNKS]; - struct list_head buddied; + union { + /* + * Reuse unbuddied[0] as buddied on the ground that + * unbuddied[0] is unused. + */ + struct list_head buddied; + struct list_head unbuddied[NCHUNKS]; + }; struct list_head lru; u64 pages_nr; const struct zbud_ops *ops; -- 2.23.0