Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1396595pxb; Thu, 21 Oct 2021 23:26:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwXR5imaxCW4YCrHxcdX1/ErPNMKFSwNbomsswYomXG/bvPmfrtKH5U+k3buyLJgBscI8De X-Received: by 2002:a17:906:3513:: with SMTP id r19mr4614851eja.424.1634883988690; Thu, 21 Oct 2021 23:26:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634883988; cv=none; d=google.com; s=arc-20160816; b=Cf/jFQFJEOygCyxt3Nad7JGH9/TJ9fPhjOwUg6ohIyOuDz46JUKU4oOqfgwdPh3OAS RRkqd5vrdg4TCejLNkYfcTsNaXP9gz8oM0F2Bj81Jr9ZZM1VoPt1Fw8LKcxexqniZia/ shkOpmQ2F3CjbMNv2uolNoJJXOHb6MhmN8BeD7ambrj36ONYM3eb+DDLGmDRfWWNn5eB UJ/ixZnVHDR2VQ25P++1u1LKb/tooiOmkyiufq0eSESFo0NLDfZPywlyQ2kg+YESNa/C RlUrEZYgHrR/D4OZHZbZ450K92M4kSHSQ9bOvOxw1FWIyISyPNEldvs519rPghqmiTix vvdQ== 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=Ctmgqf8uxyooX2WRkX0mknbdlJbxHMg1YGMmHUwmvMo=; b=fjbgG5eISuFIP5IEigq0ToEIjuarywa55uuTpZroxicjAPEuzFjGyg3GxYfqETlBtZ hrHQ8XTdvECovZckWfq9zmhFKyeyATB60LXaCygBaf2vIVXJg52X5QraVmZXYjSmIH9Z aF7ofuzgfjJKUkVJAKepNmzSL0byk1PoHIbNEvzH1KVLE+kD/maeNWjvno5khydSy6GQ Gp6YsjHIwM6LpN9wuVBCLTREfobisPnaH7b/Q14qbeqEChhJq/gycMngY+j4ZxX1tars YDGeX7wckM0eIZudlrVIKBCdkMfJgt6rmTiuCWhHeOfu5peKiDxXyYxiW1K80mO+t+kF wV8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=XyZMPi56; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dz20si14906362edb.246.2021.10.21.23.26.05; Thu, 21 Oct 2021 23:26:28 -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=@gmail.com header.s=20210112 header.b=XyZMPi56; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231984AbhJVG0W (ORCPT + 99 others); Fri, 22 Oct 2021 02:26:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57634 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbhJVG0U (ORCPT ); Fri, 22 Oct 2021 02:26:20 -0400 Received: from mail-io1-xd32.google.com (mail-io1-xd32.google.com [IPv6:2607:f8b0:4864:20::d32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 07FDBC061764; Thu, 21 Oct 2021 23:24:04 -0700 (PDT) Received: by mail-io1-xd32.google.com with SMTP id y67so3953364iof.10; Thu, 21 Oct 2021 23:24:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ctmgqf8uxyooX2WRkX0mknbdlJbxHMg1YGMmHUwmvMo=; b=XyZMPi56Rw07CUfQKmDI18LFyvuL2nRgfmj+7iHgcHle79EuBTDTtaH0Mj7Br3D9GX nLQhFIjno3jaMUF2jdbaYrZXedALQlCijEaOrit8/ewXjSzMITu0NjtvDR3wHc5xakIK AE4JBy6BpGRZuJTPoWG4QGvbhuCkPvFQkbOrjsW8Hd9W1EhNrge4A2XFwCJY8T9TrvR2 iIXWtOl9DQY0GOfCu+gbmpCQFaRXM1PbOMLIP3O6pm5BRDaV0RndO5O+/xUHY+qEcTNR MdGZsEBRJU92Yb5iRW+HoZTZihEsF8Pg88qYoCq5k6peuh+lTPQXCvrZpNI9Rm9offnx +pnQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ctmgqf8uxyooX2WRkX0mknbdlJbxHMg1YGMmHUwmvMo=; b=bxM8YJ/GUobiMI3JqYH3nIF/cxFAGp3nUFTmVlwMVBydALPaW35wiLwUjO6aOrNcdM kOfCmsP3RhBwNJiAsmnVZOZEphLtVGYHg5LIy2NdahPMpyuioFtE2NNA9r+F345lm/09 moQDsAwQIJ4n8Ysrj9kpAYy6pSF0yR5YYugkBk7p5sRTr5lKC0wOgkNdIi9z6kvqzIBK KGhPKX9kLDsYOoUBZv/m6+Y+o71fvW1DKWQ4uk7rZWrZXnPYP05QsjhsMNKCD6kZCSg5 bdUO5tZUGmhqEneVr9NIsJTYc5Y/8ttfulRdcPTJG4oIs5MkVCB8g5jlG1wYfNBQ/9yy Zw5Q== X-Gm-Message-State: AOAM533HIict3ryK3a9cpu96ngcA4y43+9PZDAPczd43FgvMfN3H2Ry1 KQwWNOJyYcNmNCAUfouDd3W/Kozws8FrFKeWQhI= X-Received: by 2002:a05:6638:1607:: with SMTP id x7mr6954700jas.128.1634883843551; Thu, 21 Oct 2021 23:24:03 -0700 (PDT) MIME-Version: 1.0 References: <20211021034516.4400-1-laoar.shao@gmail.com> <20211021034516.4400-4-laoar.shao@gmail.com> In-Reply-To: From: Yafang Shao Date: Fri, 22 Oct 2021 14:23:27 +0800 Message-ID: Subject: Re: [PATCH v5 03/15] sched.h: introduce TASK_COMM_LEN_16 To: Andrii Nakryiko Cc: Kees Cook , Steven Rostedt , Mathieu Desnoyers , Arnaldo Carvalho de Melo , Petr Mladek , Peter Ziljstra , Al Viro , Andrew Morton , Valentin Schneider , Qiang Zhang , robdclark , Christian Brauner , Dietmar Eggemann , Ingo Molnar , Juri Lelli , Vincent Guittot , "David S. Miller" , Jakub Kicinski , Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin Lau , Song Liu , Yonghong Song , john fastabend , KP Singh , Networking , bpf , "linux-perf-use." , linux-fsdevel@vger.kernel.org, open list , kernel test robot , kbuild test robot Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 22, 2021 at 5:55 AM Andrii Nakryiko wrote: > > On Wed, Oct 20, 2021 at 8:45 PM Yafang Shao wrote: > > > > There're many hard-coded 16 used to store task comm in the kernel, that > > makes it error prone if we want to change the value of TASK_COMM_LEN. A > > new marco TASK_COMM_LEN_16 is introduced to replace these old ones, then > > we can easily grep them. > > > > Signed-off-by: Yafang Shao > > Cc: Mathieu Desnoyers > > Cc: Peter Zijlstra > > Cc: Steven Rostedt > > Cc: Kees Cook > > Cc: Al Viro > > Cc: Petr Mladek > > --- > > include/linux/sched.h | 2 ++ > > 1 file changed, 2 insertions(+) > > > > diff --git a/include/linux/sched.h b/include/linux/sched.h > > index c1a927ddec64..62d5b30d310c 100644 > > --- a/include/linux/sched.h > > +++ b/include/linux/sched.h > > @@ -274,6 +274,8 @@ struct task_group; > > > > #define get_current_state() READ_ONCE(current->__state) > > > > +/* To replace the old hard-coded 16 */ > > +#define TASK_COMM_LEN_16 16 > > /* Task command name length: */ > > #define TASK_COMM_LEN 16 > > Can we please convert these two constants into enum? That will allow > BPF applications to deal with such kernel change more easily because > these constants will now be available as part of kernel BTF. > > Something like this should be completely equivalent for all the kernel uses: > > enum { > TASK_COMM_LEN = 16, > TASK_COMM_LEN_16 = 16, > }; > > When later TASK_COMM_LEN is defined as = 24, BPF applications will be > able to deal with that by querying BTF through BPF CO-RE. > Sure. I will convert it to enum. -- Thanks Yafang