From patchwork Thu Jul 1 01:50:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12353191 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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_RED 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 31094C11F68 for ; Thu, 1 Jul 2021 01:50:45 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DFAAC61241 for ; Thu, 1 Jul 2021 01:50:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DFAAC61241 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 6B6298D0216; Wed, 30 Jun 2021 21:50:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 68C988D0202; Wed, 30 Jun 2021 21:50:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 555EE8D0216; Wed, 30 Jun 2021 21:50:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0161.hostedemail.com [216.40.44.161]) by kanga.kvack.org (Postfix) with ESMTP id 306448D0202 for ; Wed, 30 Jun 2021 21:50:44 -0400 (EDT) Received: from smtpin13.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id F231B18030090 for ; Thu, 1 Jul 2021 01:50:43 +0000 (UTC) X-FDA: 78312339966.13.2272F02 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf11.hostedemail.com (Postfix) with ESMTP id A39A5F0000AE for ; Thu, 1 Jul 2021 01:50:43 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id BA0696146D; Thu, 1 Jul 2021 01:50:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1625104243; bh=ENApBjEaO1KjfEOhm60Hc0/aVXPQIXc8yzvZc6IY0Ck=; h=Date:From:To:Subject:In-Reply-To:From; b=SQTBmV+oX8L/dPdkw5XiOSypuyI14pAdWiJpXIt8EX5awzM0j69OajqXnZnbyWo3r yiEK9kbguXf9w5dq7uYJnclTEemY7uGijy5ajiVWrm6vErt1Eqz3jiYb4mIqovblF1 u13jFxcJ9W04GQEeKwDQR9pvL5LElafndlR9Ogck= Date: Wed, 30 Jun 2021 18:50:42 -0700 From: Andrew Morton To: akpm@linux-foundation.org, ddstreet@ieee.org, linmiaohe@huawei.com, linux-mm@kvack.org, mm-commits@vger.kernel.org, sjenning@redhat.com, torvalds@linux-foundation.org Subject: [patch 066/192] mm/zbud: reuse unbuddied[0] as buddied in zbud_pool Message-ID: <20210701015042.NdLnvShOK%akpm@linux-foundation.org> In-Reply-To: <20210630184624.9ca1937310b0dd5ce66b30e7@linux-foundation.org> User-Agent: s-nail v14.8.16 Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=SQTBmV+o; dmarc=none; spf=pass (imf11.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org X-Stat-Signature: ja6wgr7wow8qi8m6gkryb3qjj51kee96 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: A39A5F0000AE X-HE-Tag: 1625104243-477681 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: From: Miaohe Lin Subject: mm/zbud: reuse unbuddied[0] as buddied in zbud_pool Patch series "Cleanups for zbud", v2. This series contains just cleanups to save some possible memory in zbud_pool and avoid exporting any unneeded zbud API. More details can be found in the respective changelogs This patch (of 2): 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. Link: https://lkml.kernel.org/r/20210608114515.206992-1-linmiaohe@huawei.com Link: https://lkml.kernel.org/r/20210608114515.206992-2-linmiaohe@huawei.com Signed-off-by: Miaohe Lin Cc: Seth Jennings Cc: Dan Streetman Signed-off-by: Andrew Morton --- mm/zbud.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) --- a/mm/zbud.c~mm-zbud-reuse-unbuddied-as-buddied-in-zbud_pool +++ a/mm/zbud.c @@ -93,8 +93,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;