On 10/5/25 9:14 AM, Peng Fan wrote:
Per Documentation/process/coding-style.rst rule 17 regarding the use of
bool types:
If a structure has many true/false values, consider consolidating them into
a bitfield with 1-bit members, or using an appropriate fixed-width type
such as u8.
This commit replaces multiple bool members in struct rproc with 1-bit
bitfields and groups them together. This change reduces the overall size of
struct rproc from 0x4d8 to 0x4c8 on ARM64.
Most of the series looks good, but this patch I'm not a fan. This isn't
a huge savings and bitfields come with many of their own challenges.
No functional changes.
If the structure's size changed then that is a functional change. There
also is probably a performance change from extracting the value out of the
bitfield, where before they might have each been an aligned width variable
that could be tested in a single cycle.
Andrew
Signed-off-by: Peng Fan <[email protected]>
---
include/linux/remoteproc.h | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/include/linux/remoteproc.h b/include/linux/remoteproc.h
index
b4795698d8c2a4e80ccafbe632436c4dfb636a1e..d8468a96edfbd82f4011881c10f59bf7c12e9c1a
100644
--- a/include/linux/remoteproc.h
+++ b/include/linux/remoteproc.h
@@ -528,21 +528,21 @@ enum rproc_features {
* @index: index of this rproc device
* @crash_handler: workqueue for handling a crash
* @crash_cnt: crash counter
- * @recovery_disabled: flag that state if recovery was disabled
* @max_notifyid: largest allocated notify id.
* @table_ptr: pointer to the resource table in effect
* @clean_table: copy of the resource table without modifications. Used
* when a remote processor is attached or detached from the core
* @cached_table: copy of the resource table
* @table_sz: size of @cached_table
- * @has_iommu: flag to indicate if remote processor is behind an MMU
- * @auto_boot: flag to indicate if remote processor should be auto-started
- * @sysfs_read_only: flag to make remoteproc sysfs files read only
* @dump_segments: list of segments in the firmware
* @nb_vdev: number of vdev currently handled by rproc
* @elf_class: firmware ELF class
* @elf_machine: firmware ELF machine
* @cdev: character device of the rproc
+ * @recovery_disabled: flag that state if recovery was disabled
+ * @has_iommu: flag to indicate if remote processor is behind an MMU
+ * @auto_boot: flag to indicate if remote processor should be auto-started
+ * @sysfs_read_only: flag to make remoteproc sysfs files read only
* @cdev_put_on_release: flag to indicate if remoteproc should be shutdown on
@char_dev release
* @features: indicate remoteproc features
*/
@@ -570,21 +570,21 @@ struct rproc {
int index;
struct work_struct crash_handler;
unsigned int crash_cnt;
- bool recovery_disabled;
int max_notifyid;
struct resource_table *table_ptr;
struct resource_table *clean_table;
struct resource_table *cached_table;
size_t table_sz;
- bool has_iommu;
- bool auto_boot;
- bool sysfs_read_only;
struct list_head dump_segments;
int nb_vdev;
u8 elf_class;
u16 elf_machine;
struct cdev cdev;
- bool cdev_put_on_release;
+ bool recovery_disabled :1;
+ bool has_iommu :1;
+ bool auto_boot :1;
+ bool sysfs_read_only :1;
+ bool cdev_put_on_release :1;
DECLARE_BITMAP(features, RPROC_MAX_FEATURES);
};