Re: [PATCH] sched/fair: Clear target from cpus to scan in select_idle_cpu
From: Mel Gorman
Date: Thu Nov 25 2021 - 06:19:40 EST
On Wed, Nov 24, 2021 at 04:54:01PM +0800, Yicong Yang wrote:
> Commit 56498cfb045d noticed that "When select_idle_cpu starts scanning for
> an idle CPU, it starts with a target CPU that has already been checked
> by select_idle_sibling. This patch starts with the next CPU instead."
> It only changed the scanning start cpu to target + 1 but still leave
> the target in the scanning cpumask. The target still have a chance to be
> checked in the last turn. Fix this by clear the target from the cpus
> to scan.
>
> Fixes: 56498cfb045d ("sched/fair: Avoid a second scan of target in select_idle_cpu")
> Signed-off-by: Yicong Yang <yangyicong@xxxxxxxxxxxxx>
Did you check the performance of this? When I tried something like this
in a different context, I found that the cost of clearing the bit was
more expensive than simply using target + 1. For the target to be
rescanned, the whole mask would have to be scanned as no other CPUs are
idle which is the unlikely case. By clearing the bit, a cost is always
incurred even if the first CPU scanned is idle.
--
Mel Gorman
SUSE Labs