Re: [PATCH v3] io_uring/fdinfo: remove need for sqpoll lock for thread/pid retrieval

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11/15/23 2:36 AM, Jens Axboe wrote:
> 	if (has_lock && (ctx->flags & IORING_SETUP_SQPOLL)) {
> 		struct io_sq_data *sq = ctx->sq_data;
> 
>-		if (mutex_trylock(&sq->lock)) {
>-			if (sq->thread) {
>-				sq_pid = task_pid_nr(sq->thread);
>-				sq_cpu = task_cpu(sq->thread);
>-			}
>-			mutex_unlock(&sq->lock);
>-		}
>+		sq_pid = sq->task_pid;
>+		sq_cpu = sq->sq_cpu;
> 	}

There are two problems:
1.The output of SqThread is inaccurate. What is actually recorded is the PID of the parent process.
2. Sometimes it can output, sometimes it outputs -1.

The test results are as follows:
Every 0.5s: cat /proc/9572/fdinfo/6 | grep Sq
SqMask: 0x3
SqHead: 6765744
SqTail: 6765744
CachedSqHead:   6765744
SqThread:       -1
SqThreadCpu:    -1
SqBusy: 0%
-------------------------------------------
Every 0.5s: cat /proc/9572/fdinfo/6 | grep Sq
SqMask: 0x3
SqHead: 7348727
SqTail: 7348728
CachedSqHead:   7348728
SqThread:       9571
SqThreadCpu:    174
SqBusy: 95%





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux