[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220519172421.162394-28-kent.overstreet@gmail.com>
Date: Thu, 19 May 2022 13:24:20 -0400
From: Kent Overstreet <kent.overstreet@...il.com>
To: linux-kernel@...r.kernel.org, linux-mm@...r.kernel.org,
pmladek@...e.com, rostedt@...dmis.org, senozhatsky@...omium.org
Cc: Kent Overstreet <kent.overstreet@...il.com>,
andriy.shevchenko@...ux.intel.com, willy@...radead.org,
x86@...nel.org
Subject: [PATCH v2 27/28] x86/resctrl: Convert to printbuf
This converts from seq_buf to printbuf. We're using printbuf in external
buffer mode, so it's a direct conversion, aside from some trivial
refactoring in cpu_show_meltdown() to make the code more consistent.
Signed-off-by: Kent Overstreet <kent.overstreet@...il.com>
Cc: x86@...nel.org
---
arch/x86/kernel/cpu/resctrl/rdtgroup.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
index b57b3db9a6..8e4f7773b7 100644
--- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c
+++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c
@@ -19,7 +19,7 @@
#include <linux/fs_parser.h>
#include <linux/sysfs.h>
#include <linux/kernfs.h>
-#include <linux/seq_buf.h>
+#include <linux/printbuf.h>
#include <linux/seq_file.h>
#include <linux/sched/signal.h>
#include <linux/sched/task.h>
@@ -51,7 +51,7 @@ static struct kernfs_node *kn_mongrp;
/* Kernel fs node for "mon_data" directory under root */
static struct kernfs_node *kn_mondata;
-static struct seq_buf last_cmd_status;
+static struct printbuf last_cmd_status;
static char last_cmd_status_buf[512];
struct dentry *debugfs_resctrl;
@@ -59,13 +59,13 @@ struct dentry *debugfs_resctrl;
void rdt_last_cmd_clear(void)
{
lockdep_assert_held(&rdtgroup_mutex);
- seq_buf_clear(&last_cmd_status);
+ printbuf_reset(&last_cmd_status);
}
void rdt_last_cmd_puts(const char *s)
{
lockdep_assert_held(&rdtgroup_mutex);
- seq_buf_puts(&last_cmd_status, s);
+ pr_str(&last_cmd_status, s);
}
void rdt_last_cmd_printf(const char *fmt, ...)
@@ -74,7 +74,7 @@ void rdt_last_cmd_printf(const char *fmt, ...)
va_start(ap, fmt);
lockdep_assert_held(&rdtgroup_mutex);
- seq_buf_vprintf(&last_cmd_status, fmt, ap);
+ vpr_buf(&last_cmd_status, fmt, ap);
va_end(ap);
}
@@ -833,7 +833,7 @@ static int rdt_last_cmd_status_show(struct kernfs_open_file *of,
int len;
mutex_lock(&rdtgroup_mutex);
- len = seq_buf_used(&last_cmd_status);
+ len = printbuf_written(&last_cmd_status);
if (len)
seq_printf(seq, "%.*s", len, last_cmd_status_buf);
else
@@ -3248,8 +3248,8 @@ int __init rdtgroup_init(void)
{
int ret = 0;
- seq_buf_init(&last_cmd_status, last_cmd_status_buf,
- sizeof(last_cmd_status_buf));
+ last_cmd_status = PRINTBUF_EXTERN(last_cmd_status_buf,
+ sizeof(last_cmd_status_buf));
ret = rdtgroup_setup_root();
if (ret)
--
2.36.0
Powered by blists - more mailing lists