Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp1175882ybe; Mon, 2 Sep 2019 16:05:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqxFUDi+5W48KPIQNEdQazHDEgHtxJld9DJecqbYbLcgM2VbOImpQXa4B/mFZoXcs8D/uo7R X-Received: by 2002:a63:7205:: with SMTP id n5mr26976377pgc.443.1567465515115; Mon, 02 Sep 2019 16:05:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567465515; cv=none; d=google.com; s=arc-20160816; b=R/+gurbJg1FCOd8uypTlnl7ArfKZv8igbeA/6aNIRh3i9hpQoiwbTyDKrgPAatCuYA jfNay9dL2lDllJSryV9CaxOB98QYcrtwFXtH57XiDPTUnqdZaxlphuQnG7SeHXxLTkqF gKVP2zaVQ04U5KVZABXbt2R3R0TP9SfKugUvRJ/tt0g3uuIBttp/gN/96mm14I2eHl4h cQpsIma3Fiyd/fWoYiB15WBhuTuxNu+nGzOWwVJFzOlV8hiE5O3EhCiWj3SqwZCy/NEi pZ8D4Cj0hG3PsNuE7Zb1Tka1PYW5MxnqxHEbl3OHrQmPwHzm/XbLEaxk6Up4UjBasKE7 i1mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=EeAjd+8sbBplMq4xY0s/7kYv7C3fFTuiZd0CUqn896Q=; b=N4oqdVWr8KXbWlbVepT0zwpFwBda2QRVfUt5KUILFxOvpHESSQP2OFgfgSqtQAFqif vMKMVeJlayyYtF17BssmhxpVvrxIN2r2rJ2b/q6ivVh3b0sFxYjQz/tPi7vDw4WTMYGz /hUFhPBC8F7O22sHx+G586ByVRCo5WjCo5RvMApGvaij4bi3q1jXsUnyf6dY2ZziF5Kt 4P/r8orRiVHjqOxOKT4QCJlmIz8xAMridiZZp8axKxhgc/jYhgs2H0JH3WTSKU2ESZI+ HaOkqUwyml0swZ5EfHjdjWr1kbKQkS7jsSLoTwaCIxY3t3+O4hkSXPKE1zEC8vZnMk9p rj5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g92si374358plg.24.2019.09.02.16.04.59; Mon, 02 Sep 2019 16:05:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726872AbfIBXCu (ORCPT + 99 others); Mon, 2 Sep 2019 19:02:50 -0400 Received: from foss.arm.com ([217.140.110.172]:58592 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726775AbfIBXCu (ORCPT ); Mon, 2 Sep 2019 19:02:50 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 82626344; Mon, 2 Sep 2019 16:02:49 -0700 (PDT) Received: from [10.0.2.15] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2D2563F59C; Mon, 2 Sep 2019 16:02:48 -0700 (PDT) Subject: Re: [PATCH] sched: make struct task_struct::state 32-bit To: Alexey Dobriyan , mingo@redhat.com, peterz@infradead.org Cc: linux-kernel@vger.kernel.org, rcu@vger.kernel.org, linux-block@vger.kernel.org, dm-devel@redhat.com, axboe@kernel.dk, aarcange@redhat.com References: <20190902210558.GA23013@avx2> From: Valentin Schneider Message-ID: <7b94004e-4a65-462b-cd6b-5cbd23d607bf@arm.com> Date: Tue, 3 Sep 2019 00:02:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190902210558.GA23013@avx2> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 02/09/2019 22:05, Alexey Dobriyan wrote: > 32-bit accesses are shorter than 64-bit accesses on x86_64. > Nothing uses 64-bitness of ->state. > > Space savings are ~2KB on F30 kernel config. > > Signed-off-by: Alexey Dobriyan > --- Interestingly this has been volatile long since forever (or 2002, which is my take on "forever" given the history tree), although the task states seem to have never gone above 0x1000 (the current TASK_STATE_MAX). [...] > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -643,7 +643,7 @@ struct task_struct { > struct thread_info thread_info; > #endif > /* -1 unrunnable, 0 runnable, >0 stopped: */ > - volatile long state; > + volatile int state; This leads to having some padding after this field (w/o randomization): struct task_struct { struct thread_info thread_info; /* 0 24 */ volatile int state; /* 24 4 */ /* XXX 4 bytes hole, try to pack */ void * stack; /* 32 8 */ Though seeing as this is also the boundary of the randomized layout we can't really do much better without changing the boundary itself. So much for cacheline use :/ Anyway, task_struct doesn't shrink but we can cut some corners in the asm, I guess that's fine? [...]