Re: Regression with 40f61ec71936 ("cpus_allowed: use __NRPROCESSORS_CONF instead of __SC_NPROCESSORS_ONLN for non-sequential CPU ids") and Idleness Profiling

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

 



On Sat, Jun 08, 2024 at 03:44:36PM +0200, Benjamin Block wrote:
> Making a small change like this to the profiling thread
> 
>     @@ -123,13 +123,11 @@ static void *idle_prof_thread_fn(void *data)
>      
>      	/* exit if other threads failed to initialize */
>      	if (ipc.status == IDLE_PROF_STATUS_ABORT) {
>     -		pthread_mutex_unlock(&ipt->start_lock);
>      		goto do_exit;
>      	}
>      
> v     	/* exit if we are doing calibration only */
>      	if (ipc.status == IDLE_PROF_STATUS_CALI_STOP) {
>     -		pthread_mutex_unlock(&ipt->start_lock);
>      		goto do_exit;
>      	}
>      
>     @@ -151,10 +149,9 @@ static void *idle_prof_thread_fn(void *data)
>      idle_prof_done:
>      
>      	ipt->loops = j + (double) k / page_size;
>     +do_exit:
>      	ipt->state = TD_EXITED;
>      	pthread_mutex_unlock(&ipt->start_lock);
>     -
>     -do_exit:
>      	free_cpu_affinity(ipt);
>      	return NULL;
>      }
> 
> fixes the issue that `fio` doesn't exit in case a profiling thread
> aborts/exits before reaching their main loop.

Ah, this is also buggy :D 

            if (retval == -1) {
                    ipt->state = TD_EXITED;
                    pthread_mutex_unlock(&ipt->init_lock);
                    goto do_exit;
            }

above uses the same label before having locked `ipt->start_lock`, but the idea
applies.

-- 
Best Regards, Benjamin Block        /        Linux on IBM Z Kernel Development
IBM Deutschland Research & Development GmbH    /   https://www.ibm.com/privacy
Vors. Aufs.-R.: Wolfgang Wendt         /        Gesch?ftsf?hrung: David Faller
Sitz der Ges.: B?blingen     /    Registergericht: AmtsG Stuttgart, HRB 243294




[Index of Archives]     [Linux Kernel]     [Linux SCSI]     [Linux IDE]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux