core/namespace: drop bitfield annotations from boolean fields

Such microoptimization makes sense when the structure is used in many many copies,
but here's it's not, and the few bytes we save are not worth the extra code the
compiler has to generate:

    return  ns_info->mount_apivfs ||
            ns_info->protect_control_groups ||
            ns_info->protect_kernel_tunables ||
            ...
before:
  49b187:       48 8b 45 f8             mov    -0x8(%rbp),%rax
  49b18b:       0f b6 00                movzbl (%rax),%eax
  49b18e:       83 e0 80                and    $0xffffff80,%eax
  49b191:       84 c0                   test   %al,%al
  49b193:       75 32                   jne    49b1c7 <namespace_info_mount_apivfs+0x80>
  49b195:       48 8b 45 f8             mov    -0x8(%rbp),%rax
  49b199:       0f b6 00                movzbl (%rax),%eax
  49b19c:       83 e0 08                and    $0x8,%eax
  49b19f:       84 c0                   test   %al,%al
  49b1a1:       75 24                   jne    49b1c7 <namespace_info_mount_apivfs+0x80>
  49b1a3:       48 8b 45 f8             mov    -0x8(%rbp),%rax
  49b1a7:       0f b6 00                movzbl (%rax),%eax
  49b1aa:       83 e0 10                and    $0x10,%eax
  49b1ad:       84 c0                   test   %al,%al
  49b1af:       75 16                   jne    49b1c7 <namespace_info_mount_apivfs+0x80>

after:
  49b024:       48 8b 45 f8             mov    -0x8(%rbp),%rax
  49b028:       0f b6 40 07             movzbl 0x7(%rax),%eax
  49b02c:       84 c0                   test   %al,%al
  49b02e:       75 2e                   jne    49b05e <namespace_info_mount_apivfs+0x7a>
  49b030:       48 8b 45 f8             mov    -0x8(%rbp),%rax
  49b034:       0f b6 40 03             movzbl 0x3(%rax),%eax
  49b038:       84 c0                   test   %al,%al
  49b03a:       75 22                   jne    49b05e <namespace_info_mount_apivfs+0x7a>
  49b03c:       48 8b 45 f8             mov    -0x8(%rbp),%rax
  49b040:       0f b6 40 04             movzbl 0x4(%rax),%eax
  49b044:       84 c0                   test   %al,%al
  49b046:       75 16                   jne    49b05e <namespace_info_mount_apivfs+0x7a>
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-09-22 12:48:25 +02:00
parent 06ca077ba2
commit 89de370edd
1 changed files with 13 additions and 13 deletions

View File

@ -64,15 +64,15 @@ typedef enum ProcSubset {
} ProcSubset;
struct NamespaceInfo {
bool ignore_protect_paths:1;
bool private_dev:1;
bool private_mounts:1;
bool protect_control_groups:1;
bool protect_kernel_tunables:1;
bool protect_kernel_modules:1;
bool protect_kernel_logs:1;
bool mount_apivfs:1;
bool protect_hostname:1;
bool ignore_protect_paths;
bool private_dev;
bool private_mounts;
bool protect_control_groups;
bool protect_kernel_tunables;
bool protect_kernel_modules;
bool protect_kernel_logs;
bool mount_apivfs;
bool protect_hostname;
ProtectHome protect_home;
ProtectSystem protect_system;
ProtectProc protect_proc;
@ -82,10 +82,10 @@ struct NamespaceInfo {
struct BindMount {
char *source;
char *destination;
bool read_only:1;
bool nosuid:1;
bool recursive:1;
bool ignore_enoent:1;
bool read_only;
bool nosuid;
bool recursive;
bool ignore_enoent;
};
struct TemporaryFileSystem {