Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp795888pxb; Tue, 14 Sep 2021 08:55:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5GW+13LnGfsPGwDUofXJXPfcreMGjzQWMNPmZRp/eL8BMOGsNbrOcINLhnUnYqHw51Z/M X-Received: by 2002:a02:3b67:: with SMTP id i39mr15170091jaf.100.1631634912713; Tue, 14 Sep 2021 08:55:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631634912; cv=none; d=google.com; s=arc-20160816; b=juf+VBGCaV/EoX65wEzR0yghCmhly9rWs1kaP80742x/bXWEe/3rZla4xEESe5BeZm 9hBh2te4hebBFQOv3Z3hsLGYDME6IEFUNwratdS7PZA2YW6frdRMgAA9RWQFYXkxe/z8 oiPI4HquYeQLu2r8TCCnhQ8u9UErm/QvgJ7eaNMNihonYHaG9V9OP+rzvwnWuOCDXJSU UUCKdkCnYkXLyeGL8b6cYcOizGVRuWSpyedFZ/lNZylwvejZmbmCJAjn4gP1GN+VTWLY m5gis/m6oKkafaQgdz6FhyNRiE4mu7S38/YiHAU3KPnwE8uf6iTBmUx8GhuvNDCvGxsB QtpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=L2GmueaozJt7D1o7Y1iltvbIRxbU2B/E9TkLnwet1MM=; b=BDBiSLdUsU4lSAE8QIWTsZBhK8YxqE389z9SG2imJ+Qactmd+Sc8EZWgVigePmbPrB +3kF7jZxpmjZuWKbTQ+U8LcnyZI4fi8aZghas07ebnmQsLZQJKIbhHCuysYKtXZbkJB0 UYO8ITWfZlIWizQqqSruRlYzxCfMktQQ9FfO2zEKWly2HJJBQA5VSB7+lVFA+rUJoQkN iEVyV46HF8OFS0FHptMScEoffuzQJPMRp87f8mVhI5Jd7NKTwdGCvCLW2HoQLM9bwrgH pzX6+CP9vK7lYAmdBDWn9FM6ZN96OYsJeNu1WEeI10zPjrw4Reza8CXIuo7x2EuE0xwr dAjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HZ04Xour; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s11si12215817jat.52.2021.09.14.08.55.00; Tue, 14 Sep 2021 08:55:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HZ04Xour; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234984AbhINPya (ORCPT + 99 others); Tue, 14 Sep 2021 11:54:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:46192 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234905AbhINPy3 (ORCPT ); Tue, 14 Sep 2021 11:54:29 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8B98860F11; Tue, 14 Sep 2021 15:53:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631634791; bh=SyILGKt3RsxWQZLKn6wlRw/UVoEX8mvp4miVI+z/vYo=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=HZ04Xourmi4uPI/BROV4LV3A0BImAtSUW0BcMr1LQ0ARiNbPPZMZFjVa+zXsdJi27 63UP/yltipbMB9MgHcllDWmA+E+r+KPo5uyphrDt7ZzSJMi2Gl7nMQD6pRFkDpTj2O sENkKq3SrcVv2keytWm/YehRRfuXpzHrYeAO2ovXUnHTJWvQehVzjYMHabmT0icoyS iX9iygyFIqVAlScoGbL/xTFmfpzkfWpDKttM0sJMY6weSYzGxAGuS/p9QoNurNfWy+ vHGWSHv7U1EElEFDnggSOdJI5FBrY4J9S5kTMUKsTYIF1C1j7EOi70w4LZyjXQB4fd qYfwT4p4rOeOw== Received: by mail-oo1-f42.google.com with SMTP id v20-20020a4a2554000000b0028f8cc17378so4819700ooe.0; Tue, 14 Sep 2021 08:53:11 -0700 (PDT) X-Gm-Message-State: AOAM530Hb8wLjv0RjiruUtGM56KjwDLyL1Gj8eYcTpp6PmFiFL3VO42z 1MlFh8PowEa/QNBXG3C2AJ8k3Qo+vszr2oJrrp8= X-Received: by 2002:a4a:c904:: with SMTP id v4mr14629736ooq.26.1631634790945; Tue, 14 Sep 2021 08:53:10 -0700 (PDT) MIME-Version: 1.0 References: <20210914121036.3975026-1-ardb@kernel.org> <20210914121036.3975026-6-ardb@kernel.org> In-Reply-To: From: Ard Biesheuvel Date: Tue, 14 Sep 2021 17:52:59 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 5/8] sched: move CPU field back into thread_info if THREAD_INFO_IN_TASK=y To: Linus Torvalds Cc: Linux Kernel Mailing List , Keith Packard , Russell King , Catalin Marinas , Will Deacon , Michael Ellerman , Benjamin Herrenschmidt , Christophe Leroy , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Peter Zijlstra , Kees Cook , Andy Lutomirski , Arnd Bergmann , Linux ARM , linuxppc-dev , linux-riscv , linux-s390 Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 14 Sept 2021 at 17:49, Linus Torvalds wrote: > > On Tue, Sep 14, 2021 at 5:11 AM Ard Biesheuvel wrote: > > > > static inline unsigned int task_cpu(const struct task_struct *p) > > { > > #ifdef CONFIG_THREAD_INFO_IN_TASK > > - return READ_ONCE(p->cpu); > > + return READ_ONCE(p->thread_info.cpu); > > #else > > return READ_ONCE(task_thread_info(p)->cpu); > > #endif > > Those two lines look different, but aren't. > > Please just remove the CONFIG_THREAD_INFO_IN_TASK conditional, and use > > return READ_ONCE(task_thread_info(p)->cpu); > > unconditionally, which now does the right thing regardless. > Unfortunately not. task_cpu() takes a 'const struct task_struct *', whereas task_thread_info() takes a 'struct task_struct *'. Since task_thread_info()-> is widely used as an lvalue, I would need to update task_cpu()'s prototype and fix up all the callers, some of which take the const flavor themselves. Or introduce 'const_task_thread_info()' which takes the const flavor, and cannot be used to instantiate lvalues. Suggestions welcome, but this is the cleanest I could come up with.