[Devel] [PATCH hci-8.1 v10 12/13] ve: add aio failcounter

Konstantin Khorenko khorenko at virtuozzo.com
Fri Sep 25 19:53:33 MSK 2026


From: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>

Count hits of the per-VE aio requests limit in ve.failcount.

https://virtuozzo.atlassian.net/browse/VSTOR-135520

Feature: per-ve failcounters
Signed-off-by: Vladimir Riabchun <vladimir.riabchun at virtuozzo.com>
Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 fs/aio.c           | 1 +
 include/linux/ve.h | 1 +
 kernel/ve/ve.c     | 5 +++++
 3 files changed, 7 insertions(+)

diff --git a/fs/aio.c b/fs/aio.c
index cb63416af135a..901cb622fe2c4 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -815,6 +815,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
 	if (ve->aio_nr + ctx->max_reqs > ve->aio_max_nr ||
 	    ve->aio_nr + ctx->max_reqs < ve->aio_nr) {
 		spin_unlock(&ve->aio_nr_lock);
+		ve_failcount_inc(ve, aio);
 		err = -EAGAIN;
 		goto err_ctx;
 	}
diff --git a/include/linux/ve.h b/include/linux/ve.h
index b4c9e628cb333..a400d21593b25 100644
--- a/include/linux/ve.h
+++ b/include/linux/ve.h
@@ -133,6 +133,7 @@ struct ve_struct {
 	spinlock_t		aio_nr_lock;
 	unsigned long		aio_nr;
 	unsigned long		aio_max_nr;
+	atomic_t		aio_failcount;
 #endif
 	struct vfsmount		*devtmpfs_mnt;
 };
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index be45975b74045..51cc635be2e24 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -125,6 +125,7 @@ struct ve_struct ve0 = {
 	.aio_nr_lock		= __SPIN_LOCK_UNLOCKED(ve0.aio_nr_lock),
 	.aio_nr			= 0,
 	.aio_max_nr		= AIO_MAX_NR_DEFAULT,
+	.aio_failcount		= ATOMIC_INIT(0),
 #endif
 	.meminfo_val		= VE_MEMINFO_SYSTEM,
 	.umh_running_helpers	= ATOMIC_INIT(0),
@@ -847,6 +848,7 @@ static struct cgroup_subsys_state *ve_create(struct cgroup_subsys_state *parent_
 	spin_lock_init(&ve->aio_nr_lock);
 	ve->aio_nr = 0;
 	ve->aio_max_nr = AIO_MAX_NR_DEFAULT;
+	atomic_set(&ve->aio_failcount, 0);
 #endif
 
 	return &ve->css;
@@ -1096,6 +1098,9 @@ static const struct ve_failcount_entry {
 	VE_FC_ENTRY(mnt),
 	VE_FC_ENTRY(netif),
 	VE_FC_ENTRY(bpf_prog),
+#ifdef CONFIG_AIO
+	VE_FC_ENTRY(aio),
+#endif
 	{}
 };
 

-- 
2.43.0



More information about the Devel mailing list