[PATCH net-next 3/7] netconsole: add taskname to extradata entry count

Breno Leitao posted 7 patches 11 months, 3 weeks ago
There is a newer version of this series
[PATCH net-next 3/7] netconsole: add taskname to extradata entry count
Posted by Breno Leitao 11 months, 3 weeks ago
New SYSDATA_TASKNAME feature flag to track when taskname append is enabled.

Additional check in count_extradata_entries() to include taskname in
total, counting it as an entry in extradata. This function is used to
check if we are not overflowing the number of extradata items.

Signed-off-by: Breno Leitao <leitao@debian.org>
---
 drivers/net/netconsole.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index 26ff2ed4de16bce58e9eeaf8b5b362dfaafaca0a..1b109f46512ffb7628c6b34c6efdfc301376dd53 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -104,6 +104,8 @@ struct netconsole_target_stats  {
 enum sysdata_feature {
 	/* Populate the CPU that sends the message */
 	SYSDATA_CPU_NR = BIT(0),
+	/* Populate the task name (as in current->comm) in sysdata */
+	SYSDATA_TASKNAME = BIT(1),
 };
 
 /**
@@ -701,6 +703,8 @@ static size_t count_extradata_entries(struct netconsole_target *nt)
 	/* Plus sysdata entries */
 	if (nt->sysdata_fields & SYSDATA_CPU_NR)
 		entries += 1;
+	if (nt->sysdata_fields & SYSDATA_TASKNAME)
+		entries += 1;
 
 	return entries;
 }

-- 
2.43.5
Re: [PATCH net-next 3/7] netconsole: add taskname to extradata entry count
Posted by Simon Horman 11 months, 2 weeks ago
On Fri, Feb 21, 2025 at 05:52:08AM -0800, Breno Leitao wrote:
> New SYSDATA_TASKNAME feature flag to track when taskname append is enabled.
> 
> Additional check in count_extradata_entries() to include taskname in
> total, counting it as an entry in extradata. This function is used to
> check if we are not overflowing the number of extradata items.
> 
> Signed-off-by: Breno Leitao <leitao@debian.org>

Reviewed-by: Simon Horman <horms@kernel.org>