From patchwork Sat Sep 30 03:25:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 13404926 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 31E21E77350 for ; Sat, 30 Sep 2023 03:25:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 67B118D00CD; Fri, 29 Sep 2023 23:25:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 629F58D002B; Fri, 29 Sep 2023 23:25:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F17D8D00CD; Fri, 29 Sep 2023 23:25:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 3B3368D002B for ; Fri, 29 Sep 2023 23:25:57 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 11619C04E6 for ; Sat, 30 Sep 2023 03:25:57 +0000 (UTC) X-FDA: 81291824754.23.DC891C1 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by imf07.hostedemail.com (Postfix) with ESMTP id 3D4464000F for ; Sat, 30 Sep 2023 03:25:55 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=4j7tcsHq; spf=pass (imf07.hostedemail.com: domain of hughd@google.com designates 209.85.222.173 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1696044355; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=AVLzPp93pZABCVKyWP1mAbidMk3rqNAWBwutzFqeRLc=; b=crTNV0VgF5cRaoKauiW+xzoA/Ah+4UV1WfqpcfH7nLnhe6okL1qodkMg08V1nJV+hNmAi7 esXAFvOUIMFmgCLzOy1b8dno+BuhZmbWjY3+ZSMhGYk0r9xAqXkUji/bV6c18ICvGegLmY 1K5BG9h1ywlMTzDs/BxXGwqSOluvQDk= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=4j7tcsHq; spf=pass (imf07.hostedemail.com: domain of hughd@google.com designates 209.85.222.173 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1696044355; a=rsa-sha256; cv=none; b=XUSbqACyaQdfYBGyvQUp1xf/Lzog+Me3paDPTucQaQBhWN08LvEZBtFmf56Jsmvd/xAv4e pOYx0ZAEZKGdSomOSZEyQ2I0v1W2SHSfYAE5l94/dQ35d/h8VcC83WYhD4Ks8BqFogRACh IUSlO3SGT2Geg1KvkPZe1hGVHQBDAYQ= Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-7741c2e76a3so850057485a.1 for ; Fri, 29 Sep 2023 20:25:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1696044354; x=1696649154; darn=kvack.org; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=AVLzPp93pZABCVKyWP1mAbidMk3rqNAWBwutzFqeRLc=; b=4j7tcsHqNjLGR0cp7OIGSSYZeSJ89AGVdGbYW985Rdk0SqPKy+vL+XmVm/8reDAC9m ef/OAPmPtHmhq7JXXt5w4qp77HvydDXnEnVdlkfAa1Fjo3nv+PCauSZjCImcWk8ICci/ XcDis2vRBGUD6r+ULOvFG8ML5XtP0JT/hzYeSAVtCBwtrYe/DLna1+KI4biInpvbm939 yj30cDvbOH9ohmYddXht0p7ZJKVvz36xovG15KZFZCoyXu2sJmpQx8MsP4unFudG/9ZB U7wOYw71WDFKkA5c+eMkZRA5/+FJDn1JgFjdQEZ1FZBmmHFwmpnJEtqrscgMKL43PcWC L2VQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696044354; x=1696649154; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=AVLzPp93pZABCVKyWP1mAbidMk3rqNAWBwutzFqeRLc=; b=EIOV0EXwPxSnCcWqBuAMomub8zorfL+UGilLMJNPAWPwvcAsqUWwS5XrCpW6050lts 4hypHkWD+yxlLwsn84WM+EtIXnPzP9MIUFMb6H/4SY6a6LoWdDzXIXTraJD3z6oKr451 wIbfxnDlPvDOjb8kPR5rhZwjISGwMqns8MC6rUwf/GAaXnkAo/Izdd/IRdmyKLCzjd8i 0HWwSg/4nRn4AL3DHXLPAhWwEaKrYMcfzmliTzGTUFiIlAFJ2n83sDS+Ar9062G9S/u5 00sMaPJ0p8nHHHw/GDkWSL/LVgoOAn1V1f8/bXoQM/PNP8JwUK8/byS+N5bZaXKRcPtS X1cQ== X-Gm-Message-State: AOJu0Yyc6jKYUZVsKKCTmZtu6lSa7g3TvAaobfyRGMaiCVhl5tb1582B uq6PZtzRXVOdd5ySxaJWl1zg4A== X-Google-Smtp-Source: AGHT+IHhuq7jvvojYgsSWl2axsjTICJmxo+Endia0QYqZtTKEsh/ozvTbnorz5ewJjnAk71pgSQv9w== X-Received: by 2002:a05:620a:1a1d:b0:773:eb81:d043 with SMTP id bk29-20020a05620a1a1d00b00773eb81d043mr6501303qkb.52.1696044354298; Fri, 29 Sep 2023 20:25:54 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id o7-20020a257307000000b00d43697c429esm5462075ybc.50.2023.09.29.20.25.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 20:25:53 -0700 (PDT) Date: Fri, 29 Sep 2023 20:25:38 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.attlocal.net To: Andrew Morton cc: Christian Brauner , Carlos Maiolino , Chuck Lever , Jan Kara , Matthew Wilcox , Johannes Weiner , Axel Rasmussen , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 1/8] shmem: shrink shmem_inode_info: dir_offsets in a union In-Reply-To: Message-ID: <86ebb4b-c571-b9e8-27f5-cb82ec50357e@google.com> References: MIME-Version: 1.0 X-Rspamd-Queue-Id: 3D4464000F X-Rspam-User: X-Stat-Signature: z5346qwjcuiu3jxotd3en3zw4ksmzkzk X-Rspamd-Server: rspam01 X-HE-Tag: 1696044355-893876 X-HE-Meta: U2FsdGVkX1/JoNK9+id2BlJVjfn1vj3dg2sgX2MQ3eRBESwpgCrVEh8JLn3RS+fnYSfohQSEr8wICJ6chWP6wCbD8bT9iBstBWZxKMoof1YbLoVQsH7N+YMbs2D7Zyksm6fQfvNkdk3Qm44jEG1Z0NqLF1WaBFhClfIIa+Gxx70d+DVmsyzSCfZqcF7QDmLU4596zyxyOJV2x5bLQdWYRMZNEOOM/2iOu9K08ND7mogmosxfSti+aIIh15Kzq7qN6BZeb6WUX/AMwapxpD6kExfqEcUqbp5xy+4NGQharktgZarUA4sO8LF/aCiGO8JmtI6nx5QHt4Yc6+UphgSxUuUzebu9sbnDK07zRRHXCCmn60ICAZavFZIMEn4M0mbqXsI70G8b46PqYkUKFV8+MdiuTkZS1SE+tlUeec1LAMeyCGQqqkL6aKocCYxZT2wJArDhcKSlPNRDjMUdxWtso2xA6bcjho7Y354hUlYXItNi5oZfh7sZ6JgFNu33U91VQY7pEpgEh3R7S04kcAYCKFErSQTO61ovDowMlN4s3e7052TtbQONFzmAOEwP9O7WBdo2d+NPdD1mJoH+VLM7sV9o2RaLKS84yAo2Hlu1s1eqYKFAiqz5tT8MQq3pEDnaZ1+aXX2EGGyOV30Fo+biDvoYb1RqksY3da7Qehlpt7SVBi0tEj0p1KL26lvv/MpOr3jvqygLNhxCs2AZJ43kl4fLe7auXC/tDgJz/M4xXLC4dgaT3tvGZ6Gubly8DMJWqGJFVoy9FPSDfZZOAn8jxAcYkvmwSlGOzmf9pifh9P3mLvJmO2k4OC+mYRqxJXn4zZ5+hp6cbXikLc5hhhaTWE0iPhmP6wwKfCv8fbGgufpb/pIr++f8TXiC7qF98FPwtKCsBuVcQF+0rPBR/2oyDSc1EhP5wSWZ1ZRoQCvfFIgYB1LCpOwFSbkCfewT7pBW5wfTUYdZga1ltVPJo97 Bq5XQZaA wxKmCKQ33i//8I+Nb5PF3sS9DY0+Ni9XrD6PDQveawpK8H7BZKPXXEoZRPBWi2VJcG0kR6kxrMB4SekO5hEHVmjRECn64gMlcoPxcWTrVOpMkkdNpHljdxXO3qWedXpKq7aaHIZeWVYGXxNfLqzvK11wFa6F+BIsO+YE7fn2S9HG9/DYJmNIguHO/5LjmD3lQznsN8xZiMnGMzI430/VKaHoEiP7bouw8MHJdWbT3a9bjS/R5wDAPq3FByrsCfS2DkbtzQiymAoreT9wdu3zusCF+BASdR/DpOKCTby6MrDIS7YVtDW9jvbno6Q2ljiiL5sB7ggFJxglaa+/gA8GgYHumk6YrqEOaE9yu+BPc34hDxUKqH5Cmu+k0KL7LbDp0y/PoWAjMR+WgLmKdw8Lh9ePrFD8uZiaUJOBIOiFsOJK1aXfgQYLBgLKrKA== 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: Shave 32 bytes off (the 64-bit) shmem_inode_info. There was a 4-byte pahole after stop_eviction, better filled by fsflags. And the 24-byte dir_offsets can only be used by directories, whereas shrinklist and swaplist only by shmem_mapping() inodes (regular files or long symlinks): so put those into a union. No change in mm/shmem.c is required for this. Signed-off-by: Hugh Dickins Reviewed-by: Chuck Lever Reviewed-by: Jan Kara --- include/linux/shmem_fs.h | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/include/linux/shmem_fs.h b/include/linux/shmem_fs.h index 6b0c626620f5..2caa6b86106a 100644 --- a/include/linux/shmem_fs.h +++ b/include/linux/shmem_fs.h @@ -23,18 +23,22 @@ struct shmem_inode_info { unsigned long flags; unsigned long alloced; /* data pages alloced to file */ unsigned long swapped; /* subtotal assigned to swap */ - pgoff_t fallocend; /* highest fallocate endindex */ - struct list_head shrinklist; /* shrinkable hpage inodes */ - struct list_head swaplist; /* chain of maybes on swap */ + union { + struct offset_ctx dir_offsets; /* stable directory offsets */ + struct { + struct list_head shrinklist; /* shrinkable hpage inodes */ + struct list_head swaplist; /* chain of maybes on swap */ + }; + }; + struct timespec64 i_crtime; /* file creation time */ struct shared_policy policy; /* NUMA memory alloc policy */ struct simple_xattrs xattrs; /* list of xattrs */ + pgoff_t fallocend; /* highest fallocate endindex */ + unsigned int fsflags; /* for FS_IOC_[SG]ETFLAGS */ atomic_t stop_eviction; /* hold when working on inode */ - struct timespec64 i_crtime; /* file creation time */ - unsigned int fsflags; /* flags for FS_IOC_[SG]ETFLAGS */ #ifdef CONFIG_TMPFS_QUOTA struct dquot *i_dquot[MAXQUOTAS]; #endif - struct offset_ctx dir_offsets; /* stable entry offsets */ struct inode vfs_inode; };