Commit 412ab21b authored by Yabin Li's avatar Yabin Li Committed by yangdepei
Browse files

hct: support 1024 processes simutaneously in the hct-mdev mode.

hygon inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I99ZNA



--------------------------------

hct support more process.

Signed-off-by: default avatarYabin Li <liyabin@hygon.cn>
Signed-off-by: default avataryangdepei <yangdepei@hygon.cn>
parent 16ede8b7
Loading
Loading
Loading
Loading
+8 −3
Original line number Diff line number Diff line
@@ -1250,7 +1250,6 @@ static int hct_share_open(struct inode *inode, struct file *file)
		return -ENOMEM;

	mutex_lock(&hct_data.lock);
	bitmap_set(hct_data.ids, 0, 1);
	id = (unsigned int)find_first_zero_bit(hct_data.ids, MCCP_INSTANCE_MAX);
	if (id < MCCP_INSTANCE_MAX)
		bitmap_set(hct_data.ids, id, 1);
@@ -1267,7 +1266,13 @@ static int hct_share_open(struct inode *inode, struct file *file)
	mutex_unlock(&hct_share.lock);

	file->private_data = private;
	private->id = id << MCCP_INSTANCE_OFFSET;
	/*
	 * At user space, each process is assigned a different number
	 * which cannot be 0, as the identifier for the process.
	 * The number is assigned by id, so the value of id needs to
	 * start from 1, and cannot be 0.
	 */
	private->id = (++id) << MCCP_INSTANCE_OFFSET;
	INIT_LIST_HEAD(&private->head);
	mutex_init(&private->lock);

@@ -1891,7 +1896,7 @@ static int hct_share_close(struct inode *inode, struct file *file)
	mutex_unlock(&hct_share.lock);

	mutex_lock(&hct_data.lock);
	if (id < MCCP_INSTANCE_MAX)
	if (--id < MCCP_INSTANCE_MAX)
		bitmap_clear(hct_data.ids, id, 1);
	mutex_unlock(&hct_data.lock);