[PATCH v5 4/8] drm/i915/gvt: introduce the vGPU LRU list

Tian, Kevin kevin.tian at intel.com
Wed Mar 29 03:42:51 UTC 2017


> From: Gao, Ping A
> Sent: Wednesday, March 29, 2017 11:27 AM
> 
> >>  static struct list_head *get_sched_head(struct gvt_sched_data
> >> *sched_data) {
> >>  	struct intel_gvt *gvt = sched_data->gvt; @@ -152,8 +184,17 @@
> >> static struct list_head *get_sched_head(struct gvt_sched_data
> *sched_data)
> >>  		cur_vgpu_data = scheduler->current_vgpu->sched_data;
> >>  		head = &cur_vgpu_data->list;
> >>  	} else {
> >> +		struct vgpu_sched_data *lru_vgpu_data;
> >> +
> >>  		gvt_dbg_sched("no current vgpu search from q head\n");
> >> -		head = &sched_data->runq_head;
> >> +
> >> +		/* Choose new head according to lru list to avoid
> >> +		 * unfairness when current_vgpu set to NULL because
> >> +		 * of the vGPU stop/kill.
> >> +		 */
> >> +		lru_vgpu_data = container_of(sched_data-
> >>> lru_vgpu_head.next,
> >> +					struct vgpu_sched_data, lru_list);
> >> +		head = lru_vgpu_data->list.prev;
> > Since later lru_list is specially handled, why do you need handle it
> > here?
> >
> >> +	next_vgpu = find_longest_unsched_vgpu(&sched_data-
> >>> lru_vgpu_head);
> > Also above sequence looks different from your earlier commit msg. You
> > choose lru list here only when there is no current vgpu, i.e. not
> > treating it as higher priority than normal runq.
> 
> When current_vgpu is set to NULL, there is no idea where to start to pick up
> vgpu in the runq list,  here is to get the who is the LRU vGPU, and then start
> to pick up this vGPU in runq.
> 
> So LRU list has two purpose :
> 1. help to find urgent vgpu.
> 2. help to find a proper point in the runq where start to pick when
> current_vgpu set to NULL or idle vGPU in next patch.
> 
> I need change the commit msg :)

However you didn't use get_sched_head at all for LRU list. It's absolutely
walked as below:

> >>  	head = get_sched_head(sched_data);
> >>
> >> -	/* Choose the vGPU which has pending workload. */
> >> -	next_vgpu = find_busy_vgpu(head, sched_data);
> >> +	/* Find out the vGPU which have not been scheduled near a max
> >> +	 * threshold, then execute it immediately to avoid guest TDR.
> >> +	 */
> >> +	next_vgpu = find_longest_unsched_vgpu(&sched_data-
> >>> lru_vgpu_head);


More information about the intel-gvt-dev mailing list