Received: by 2002:a05:6a10:8395:0:0:0:0 with SMTP id n21csp328052pxh; Wed, 10 Nov 2021 02:27:18 -0800 (PST) X-Google-Smtp-Source: ABdhPJxRmlkbJ4gPkVX3tPm8NChd6Zv8kyPypXCcDBVc3X2dVEnPORvu6uapnEovXI70nhkOXMUe X-Received: by 2002:a5e:d602:: with SMTP id w2mr9786120iom.121.1636540038794; Wed, 10 Nov 2021 02:27:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1636540038; cv=none; d=google.com; s=arc-20160816; b=EIyd2txaJn+j9HQ3VrOKV2LQ0qh6YCxvCEWm9LcSp6YNbXJX0SMFPolxaZnIV0W6XS LRtspdhmixfh5rBs+W2zpfJ+P1ioVz/QDLJHNnpQ7RoHOXVoklLiHj58kMRqLUBzaE5z qxP6tvQiwHcNo4TGIBjnQRhvGJXIneDQoRdfAtIrQKTbYyOF+ZsNjXTXO7q4BJkhnBCv 9fdNOZ+5oE2LdvK7JqtTQGZSBk6UQnLCAf407+jKIIK00H2o83lGf9g6CMyfKndVsrkn 6mpAT4V5EwDMXmyAaJNMPsDgk7dSIRGb80kW/DOUo6/5d01pTaC9PmEdSKkE2EW0SI1x wdXA== 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=FRo15B7Lv4BayCoNMhY7C89mwEIQ8JKoKf1uS0Z17yc=; b=YTV0mbYBECUTE4eKq21wQbAGfHLQ1j6N9QSt7NWh9pPq+CQTe3sAlDWTsgPWistO2n B6uWL/DbQw/5lOUlmLL1XJ4y/tWmeVou4/9Jr1HNKd6i7oN2mU2llQYp2fNEJof9H0ZI R6p4w2PYRboHD/qaoDBppKwwBpUkoh953siqe1dnpOAwcCn3UYRhFq1OsVAm/j8Gi6W7 f70SP/S2wTBvYrB7gWMXp8sGhtvjlcrZ4x3e3o4jg+h2YY33GeIeLnQkC3AfjvnU5+gh iA7lsOksqq1Xf94Q6Np0G5d+pYHISe9IeLaiqnXgrMXGhlgTKz3C0qGb/M5zIHF5pO4J bi4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Hi1N5m0l; 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 b22si333180iow.23.2021.11.10.02.27.05; Wed, 10 Nov 2021 02:27:18 -0800 (PST) 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=Hi1N5m0l; 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 S231172AbhKJK1M (ORCPT + 99 others); Wed, 10 Nov 2021 05:27:12 -0500 Received: from mail.kernel.org ([198.145.29.99]:57942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231171AbhKJK1L (ORCPT ); Wed, 10 Nov 2021 05:27:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 75E7161246 for ; Wed, 10 Nov 2021 10:24:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1636539864; bh=QeVNYL1CDnVnsGgYCWWDeh9BlVaKep9JspI98WE81KQ=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=Hi1N5m0lKVCCZVpEKK2WpErMzrO1B9aH44pHFN1lHi6V0THXhZyOmQMbMynDypCN1 EwTWwwqzqJ2bfvBT379BhRhGsHRDe/wCX9ndAsiMuvQ2ru425W175IYFSN0Wd0PoLK rBKaqiZQ1N3e+1au5hejsar8bFxbz2c2X/mE5+uuGqCmfVD1X3dNzOyDt2iclEPf7J jzl7HnCXW/RlF2fcyW/nZ3YCul7xHTHLjpEOnfIIKS5nmP6x0NriOlGCbJ8mQzl3Vu NhkGmwOTjX6Lh9HQE3snAJ6qVCDKpS8PTavGNLxpe4y2TmyOfVxajJAahWcgYS1DRG AAW5DZjwlFT+Q== Received: by mail-ot1-f44.google.com with SMTP id g91-20020a9d12e4000000b0055ae68cfc3dso3149991otg.9 for ; Wed, 10 Nov 2021 02:24:24 -0800 (PST) X-Gm-Message-State: AOAM533icfrr8YUTB/izkTPr4Ooeb3vt4oD8RwB1SAU/9wUO4F4dm8Le Od2zj3iPR+XemU0yqVYeoTcjZwNjWgkmH+cStOI= X-Received: by 2002:a05:6830:1445:: with SMTP id w5mr3992681otp.112.1636539863786; Wed, 10 Nov 2021 02:24:23 -0800 (PST) MIME-Version: 1.0 References: <20211110010906.1923210-1-eric.dumazet@gmail.com> <20211110010906.1923210-3-eric.dumazet@gmail.com> In-Reply-To: From: Ard Biesheuvel Date: Wed, 10 Nov 2021 11:24:12 +0100 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] jump_label: refine placement of static_keys To: Peter Zijlstra Cc: Eric Dumazet , linux-kernel , Eric Dumazet , Josh Poimboeuf , Jason Baron , "Steven Rostedt (VMware)" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 10 Nov 2021 at 09:36, Peter Zijlstra wrote: > > On Tue, Nov 09, 2021 at 05:09:06PM -0800, Eric Dumazet wrote: > > From: Eric Dumazet > > > > With CONFIG_JUMP_LABEL=y, "struct static_key" content is only > > used for the control path. > > > > Marking them __read_mostly is only needed when CONFIG_JUMP_LABEL=n. > > Otherwise we place them out of the way to increase data locality. > > > > This patch adds __static_key to centralize this new policy. > > > > Signed-off-by: Eric Dumazet > > --- > > arch/x86/kvm/lapic.c | 4 ++-- > > arch/x86/kvm/x86.c | 2 +- > > include/linux/jump_label.h | 25 +++++++++++++++++-------- > > kernel/events/core.c | 2 +- > > kernel/sched/fair.c | 2 +- > > net/core/dev.c | 8 ++++---- > > net/netfilter/core.c | 2 +- > > net/netfilter/x_tables.c | 2 +- > > 8 files changed, 28 insertions(+), 19 deletions(-) > > > > Hurmph, it's a bit cumbersome to always have to add this __static_key > attribute to every definition, and in fact you seem to have missed some. > > Would something like: > > typedef struct static_key __static_key static_key_t; > > work? I forever seem to forget the exact things you can make a typedef > do :/ No, that doesn't work. Section placement is an attribute of the symbol not of its type. So we'll need to macro'ify this. But I'm not sure I understand why we need different policies here. Static keys are inherently __read_mostly (unless they are not writable to begin with), so keeping them all together in one place in the binary should be sufficient, no?