Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1052963iob; Fri, 13 May 2022 21:14:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzJne1ijL4UH6ZEg8IjGqNBUUoTt8BJjk47Leep7x0QiveZ28qcWmv2GXRC+FgzZudedb1V X-Received: by 2002:a1c:721a:0:b0:394:7a5:a1f3 with SMTP id n26-20020a1c721a000000b0039407a5a1f3mr17337104wmc.104.1652501658268; Fri, 13 May 2022 21:14:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652501658; cv=none; d=google.com; s=arc-20160816; b=aVkuydDiVq/jSNCcgcDK42HVXfLDrtbTVyKQiOI39gttRcZNdBw7IbqWG4CmXnl1PY eEe0WWnP31X2dw+lrzVfbETAwuPrchdEsHJHC0sdyrkSbbKDX+1VsU6mv9XueFansXLA fxTnEIGFeNivpBRROsL56MTfi6yQE8ZCwt4jWd/71YlLUridHter5WQ6oeLviDYKRrJC ylyoC9Y7zYIh2eJ4N5L7FiXWQ+pyNNBRNkLlrk2nMdIgLLDcgNCy75xb1PGnDxz5DiI5 5VFRMC89/7eUjE/y/rxAwpBsPtmYDrUEcy4qE54vo1Brk3QQd9Mb6C6PpjlSSLSKPa35 hB3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=d4We6agwQOPTxlWjdIrPkNeOAqoGNEkVnxdLI5bC+NQ=; b=cH5XkQw8rp9te6nomX8XZMeTgFGypst6RfK/NcH+Pd65EpW5HEAD01xMWHkwgcL9JE alK838+R3Vmud/8U1k5z0a/FW1eKCgk9lazIo5bPwwAlOkstyGSjVyYVmtSVcXmB/Uud Dx/8oPRrl8dWMzUTMSHJacAhSGvdRZeapa74u7uR1JuzRkaG3rOBIv25vYxTNj7rJBNR I8FNbApBEojDThf4qjnBdzEkO7ZlVoKaLoK84Z4zKetUoArHvyd57i+EbFLQYVzOvCcr fjOI9AC9dF6MiALyOPxSnx3utxFKfNv1C9l9nkg59FpndhcOkmNhqahJlf5SKLVPfN88 WaeA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id z16-20020adff1d0000000b0020af1a4f6e5si3368071wro.791.2022.05.13.21.14.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 21:14:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 6FAF44E30C8; Fri, 13 May 2022 17:45:21 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1358565AbiELU7m (ORCPT + 99 others); Thu, 12 May 2022 16:59:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349618AbiELU7l (ORCPT ); Thu, 12 May 2022 16:59:41 -0400 Received: from www62.your-server.de (www62.your-server.de [213.133.104.62]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3E45727BC56; Thu, 12 May 2022 13:59:40 -0700 (PDT) Received: from sslproxy06.your-server.de ([78.46.172.3]) by www62.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92.3) (envelope-from ) id 1npFuG-000B4N-E9; Thu, 12 May 2022 22:59:32 +0200 Received: from [85.1.206.226] (helo=linux.home) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1npFuG-000IPr-1T; Thu, 12 May 2022 22:59:32 +0200 Subject: Re: [PATCH 1/2] kernel/bpf: change "char *" string form to "char []" To: liqiong , Yonghong Song , Andrii Nakryiko , Martin KaFai Lau , Song Liu Cc: Alexei Starovoitov , John Fastabend , KP Singh , netdev@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, hukun@nfschina.com, qixu@nfschina.com, yuzhe@nfschina.com, renyu@nfschina.com References: <20220512142814.26705-1-liqiong@nfschina.com> <223f19c0-70a7-3b1f-6166-22d494b62b6e@nfschina.com> From: Daniel Borkmann Message-ID: <92cc4844-5815-c3b0-63be-2e54dc36e1d9@iogearbox.net> Date: Thu, 12 May 2022 22:59:31 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <223f19c0-70a7-3b1f-6166-22d494b62b6e@nfschina.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.103.5/26539/Thu May 12 10:04:41 2022) X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/12/22 7:08 PM, liqiong wrote: > 在 2022年05月12日 23:16, Yonghong Song 写道: >> >> On 5/12/22 7:28 AM, liqiong wrote: >>> The string form of "char []" declares a single variable. It is better >>> than "char *" which creates two variables. >> >> Could you explain in details about why it is better in generated codes? >> It is not clear to me why your patch is better than the original code. > > The string form of "char *" creates two variables in the final assembly output, > a static string, and a char pointer to the static string. Use "objdump -S -D *.o", > can find out the static string occurring at "Contents of section .rodata". There are ~360 instances of this type in the tree from a quick grep, do you plan to convert all them ? Thanks, Daniel