[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <be23f55c-329c-444d-b5d8-83ae29b05387@igalia.com>
Date: Wed, 4 Jun 2025 18:11:02 +0200
From: Changwoo Min <changwoo@...lia.com>
To: Lukas Wunner <lukas@...ner.de>
Cc: lukasz.luba@....com, rafael@...nel.org, len.brown@...el.com,
pavel@...nel.org, christian.loehle@....com, tj@...nel.org,
kernel-dev@...lia.com, linux-pm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 04/11] PM: EM: Add the infrastructure for command
processing.
On 6/2/25 04:59, Lukas Wunner wrote:
> On Thu, May 29, 2025 at 09:13:08AM +0900, Changwoo Min wrote:
>> +static int em_genl_cmd_doit(struct sk_buff *skb, struct genl_info *info)
>> +{
>> + struct param p = { .attrs = info->attrs };
>> + struct sk_buff *msg;
>> + void *hdr;
>> + int cmd = info->genlhdr->cmd;
>> + int ret = -EMSGSIZE;
>> +
>> + msg = genlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
>> + if (!msg)
>> + return -ENOMEM;
>
> Just a heads-up, I know everyone recommends NLMSG_GOODSIZE but in reality
> it's not that great because netlink_trim() reallocates the skb and copies
> the entire linear buffer if it determines that the skb is half-empty.
> Performance suffers as a result. So it's actually better to calculate
> the exact message length prior to allocation.
Thank you, Lukas, for sharing the experience. I will address it in the
next version.
Regards,
Changwoo Min
Powered by blists - more mailing lists