Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp3226572rwd; Mon, 29 May 2023 07:27:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4OZs9OVGKGkIsQKHMk2Mi5tV004NVaBCkKO1/n3ILKWVVeZf9FiMgOloZysS5mcbQ1Gpgi X-Received: by 2002:a05:6a21:33a8:b0:100:b137:3563 with SMTP id yy40-20020a056a2133a800b00100b1373563mr9788453pzb.32.1685370422263; Mon, 29 May 2023 07:27:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685370422; cv=none; d=google.com; s=arc-20160816; b=MRb3hhCFth5H/hado72KQ33+vRTF6Uy3PQXEhotyefe9STjWuzpe/cN+ymuqJwo6E3 lyVRao9CRVAvubroaAyD7QozlUEz6GVp+i95QTddjk0UARHput4ZNYNMUsCeYTIUWNiD D94SL8eIoXnAtcYo6SiCojWoOWWxxgTw+wLAdlDzFWq4vYFXoykTu93RpnVx3NJWonDr HPvk1xvEw+qzXH5IrC9Iut0tSHH8XqmYDPjnYY86Jgzkv9Z+Ze9pBxzEncim8LbtdKnS OC9rJkJgDVAEGn1+M+jYuteNDW+UOz0Hj+UCbHyWWvuz9OIM1HDX1EgOdcvVYe0/F/yr xaMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:dkim-signature; bh=QqJeUFI0e/XUEdlHTY4e2wDrM7CepfDC9k/Dx+kj8ME=; b=SHiHtLV4IghB4/IuRkXGnSIPpk5jSdpXCaAsxVfqMClahsvv3vX/1bPIhnfw3So8mD MCyVPVRECOtYI142x83cRNfpYe3FsnqwiYtcObBIhN6lPyLQkrZYvKM6YgLKwf3ZUKHH zys8eRla2yy4MXq8B8kUppiopc66MrKJUU2g6l8ACsXP/yO/WUxOxfBW2z0DNzQbqT66 j95wMttJmHtccxl91KuZjaREADQp9WmmK77H378Jlgyu+lPhyuB6h1YFYAuIqZi5uX+h tpXZli1ZhkdHYCetgy+7fid7THUg7CvgpEhRfvHbtblw4J+ue7VtZPx7ZU8rwTlCQ0QL uOZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=b+E42wo3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x24-20020a63db58000000b00534e67fd867si9662046pgi.62.2023.05.29.07.26.48; Mon, 29 May 2023 07:27:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=b+E42wo3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S230055AbjE2OXx (ORCPT + 99 others); Mon, 29 May 2023 10:23:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229667AbjE2OXv (ORCPT ); Mon, 29 May 2023 10:23:51 -0400 Received: from mail-pj1-x1034.google.com (mail-pj1-x1034.google.com [IPv6:2607:f8b0:4864:20::1034]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4190FA0; Mon, 29 May 2023 07:23:50 -0700 (PDT) Received: by mail-pj1-x1034.google.com with SMTP id 98e67ed59e1d1-2566e60cc5aso1217693a91.3; Mon, 29 May 2023 07:23:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1685370230; x=1687962230; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=QqJeUFI0e/XUEdlHTY4e2wDrM7CepfDC9k/Dx+kj8ME=; b=b+E42wo3vgI4jYGQ3xuQ9baGkNjBVT1Kt5aR+UQ0p2b8Fln0i8SIoxVZDgLgpfSulN zsmDLiWsxJfjgX9laEEmTKAcQ0e7Vd/Raii9SNkwCEauNF19mzefCuZPT+xdNLPND9RV JGd/dJ9+oSoaUtEfyoHWdZfv0FajPjkp9gCvFulxVr04ke7Gq+WWzuDQOibektfWx+Sf pCKTLK7CT9RFBrdD97d6KaEQ4uc9QcI6jtWt6eCbNsqG3E6saQagHN+q9+rNtznE6Gi0 C+jUSLACU5VuZ0ofiuRBSy7gJlTcuiBbFrB8j95CahtlVUlG9V2YLvZM52+M3elMCvYx PEFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685370230; x=1687962230; h=content-transfer-encoding:in-reply-to:content-language:from :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=QqJeUFI0e/XUEdlHTY4e2wDrM7CepfDC9k/Dx+kj8ME=; b=eL2/vflUl17UqlH9IPsJYJoIMu9VXmfI/nvrU8dvkHSaTdpyUuSQA1CMPwjuFkmWIg wXD8Ky9E7890eCeZs3i3g0RiNkbO6xnot4Hqh2cuTsJmwWEN2Phq5+9jLr5wBiJZlfdZ y3dt7pTXXDRBo/pxHT27sMiznExdTgZDKUcM3zR7RA5jPdGbWiMBK/a3ujH9EHDBRwCN fio9ZhvKnb20j2MNu4kEJ5rCEC37PJXnwOBLhMORFIaxIVBc5JZUN9LTTl8QIYdwli+N 9iHzEs+OyIKTSEQkYDF6/ZXQcXm+T2gQh399mDRLIp926RGbJgYsjh/QJYUF6t+f8WYu yIIQ== X-Gm-Message-State: AC+VfDxaozpLBRybV57UUZEGHCFpk6TnwYyodyAsxsT281lOcRdV1GON gJD6eobKwitChR81XUafbkU= X-Received: by 2002:a17:90a:748:b0:24d:f992:5286 with SMTP id s8-20020a17090a074800b0024df9925286mr10873036pje.36.1685370229465; Mon, 29 May 2023 07:23:49 -0700 (PDT) Received: from [172.30.1.35] ([14.32.163.5]) by smtp.gmail.com with ESMTPSA id 25-20020a17090a199900b0024e4f169931sm9846519pji.2.2023.05.29.07.23.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 29 May 2023 07:23:48 -0700 (PDT) Message-ID: <1d8df8d2-f44a-dd66-8e01-7e50fa147660@gmail.com> Date: Mon, 29 May 2023 23:23:45 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 Subject: Re: [PATCH] PM / devfreq: Reorder fields in 'struct devfreq_dev_status' To: Christophe JAILLET , MyungJoo Ham , Kyungmin Park , Chanwoo Choi Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, linux-pm@vger.kernel.org References: <6b1611f1440c8b73feb475723ad25f390cad3480.1683531691.git.christophe.jaillet@wanadoo.fr> From: Chanwoo Choi Content-Language: en-US In-Reply-To: <6b1611f1440c8b73feb475723ad25f390cad3480.1683531691.git.christophe.jaillet@wanadoo.fr> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham 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 23. 5. 8. 16:42, Christophe JAILLET wrote: > Group some variables based on their sizes to reduce holes. > On x86_64, this shrinks the size of 'struct devfreq_dev_status' from 72 to > 64 bytes. > > This structure is used both to allocate static variables or is embedded in > some other structures. In both cases, reducing its size is nice to have. > > Moreover, the whole structure now fits in a single cache line on x86_64. > > Finally, it makes the order of code match the order of the above kernel > doc. > > Signed-off-by: Christophe JAILLET > --- > Using pahole > > Before: > ====== > struct devfreq_dev_profile { > long unsigned int initial_freq; /* 0 8 */ > unsigned int polling_ms; /* 8 4 */ > enum devfreq_timer timer; /* 12 4 */ > bool is_cooling_device; /* 16 1 */ > > /* XXX 7 bytes hole, try to pack */ > > int (*target)(struct device *, long unsigned int *, u32); /* 24 8 */ > int (*get_dev_status)(struct device *, struct devfreq_dev_status *); /* 32 8 */ > int (*get_cur_freq)(struct device *, long unsigned int *); /* 40 8 */ > void (*exit)(struct device *); /* 48 8 */ > long unsigned int * freq_table; /* 56 8 */ > /* --- cacheline 1 boundary (64 bytes) --- */ > unsigned int max_state; /* 64 4 */ > > /* size: 72, cachelines: 2, members: 10 */ > /* sum members: 61, holes: 1, sum holes: 7 */ > /* padding: 4 */ > /* last cacheline: 8 bytes */ > }; > > > After: > ===== > struct devfreq_dev_profile { > long unsigned int initial_freq; /* 0 8 */ > unsigned int polling_ms; /* 8 4 */ > enum devfreq_timer timer; /* 12 4 */ > int (*target)(struct device *, long unsigned int *, u32); /* 16 8 */ > int (*get_dev_status)(struct device *, struct devfreq_dev_status *); /* 24 8 */ > int (*get_cur_freq)(struct device *, long unsigned int *); /* 32 8 */ > void (*exit)(struct device *); /* 40 8 */ > long unsigned int * freq_table; /* 48 8 */ > unsigned int max_state; /* 56 4 */ > bool is_cooling_device; /* 60 1 */ > > /* size: 64, cachelines: 1, members: 10 */ > /* padding: 3 */ > }; > --- > include/linux/devfreq.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/include/linux/devfreq.h b/include/linux/devfreq.h > index 7fd704bb8f3d..d312ffbac4dd 100644 > --- a/include/linux/devfreq.h > +++ b/include/linux/devfreq.h > @@ -108,7 +108,6 @@ struct devfreq_dev_profile { > unsigned long initial_freq; > unsigned int polling_ms; > enum devfreq_timer timer; > - bool is_cooling_device; > > int (*target)(struct device *dev, unsigned long *freq, u32 flags); > int (*get_dev_status)(struct device *dev, > @@ -118,6 +117,8 @@ struct devfreq_dev_profile { > > unsigned long *freq_table; > unsigned int max_state; > + > + bool is_cooling_device; > }; > > /** Applied it. Thanks. -- Best Regards, Samsung Electronics Chanwoo Choi