From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2BCFC433EF for ; Fri, 22 Oct 2021 06:24:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C5492610D2 for ; Fri, 22 Oct 2021 06:24:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231958AbhJVG0W (ORCPT ); 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-Google-Smtp-Source: ABdhPJwLZt7DEWJC59Q0R4KyCJo2IgKLomhbRWM91KQdg87yLztshdMdW65VPa3XJ6qnAbAG+eJ9OnGWBYcCvmnjD6Q= 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-fsdevel@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