lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <200712170651.04333.vda.linux@googlemail.com>
Date:	Mon, 17 Dec 2007 06:51:04 -0800
From:	Denys Vlasenko <vda.linux@...glemail.com>
To:	linux-arch@...r.kernel.org
Cc:	linux-kernel@...r.kernel.org,
	Andrew Morton <akpm@...ux-foundation.org>
Subject: [PATCH] smallint: minimum efficiently addressable memory unit

Hi arch people, Andrew,

Proposed trivial patch introduces smallint type,
which is defined as minimal efficiently addressable
memory unit. It is intended to be primarily used for
flag variables in memory.

Random example. In arch/x86/kernel/vmi_32.c:

static int disable_pge;
static int disable_pse;
static int disable_sep;
static int disable_tsc;
static int disable_mtrr;
static int disable_noidle;
static int disable_vmi_timer;

Not only each of these variables uses 4 bytes of storage
instead of 1, but stores to these variables also use longer
instructions (store of 32-bit constant 0 or 1 on x86
still has 32-bit constant in the instruction encoding).

Therefore, say, disable_noidle alone wastes 12 bytes:
three in a variable itself and 3x3 in three places where 1
is stored into it.

Patch defines smallint to be signed byte for x86.
Other arches are trivial to add.
If arch does not define it, it defaults to int.

Patch contains the following comment which is intended
to explain when this type is useful, and when it is not
(for example, using smallint for local register variable
sometimes confuses gcc, and generated code is slightly worse):

/* Minimum efficiently addressable memory unit.
 * Recommended usage: global flag or enum variables; flag/enum struct members
 * Don't use for: local variables, members of user-visible structs
 * Guaranteed to be at least byte-sized.
 */

Comments from architecture people are sought.

Signed-off-by: Denys Vlasenko <vda.linux@...glemail.com>
--
vda

View attachment "smallint.patch" of type "text/x-diff" (1360 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ