Re: [PATCH net-next] net: ipvs: random start for RR scheduler

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

 



	Hello,

On Tue, 10 May 2022, Julian Anastasov wrote:

> 	What I see is that the value 128 is good but using
> 32 (MAX_STEP in the test) gives good enough results (3% diff).

	Looks like I forgot to add this example how to
reduce code under lock because add/del dest can run in
parallel with scheduling, something that is a drawback
in this solution:

+static void ip_vs_rr_random_start(struct ip_vs_service *svc)
+{
+	struct list_head *old = READ_ONCE(svc->sched_data), *cur = old;
+	u32 start;
+
+	if (!(svc->flags & IP_VS_SVC_F_SCHED_RR_RANDOM) ||
+		svc->num_dests <= 1)   
+		return;
+
+	start = prandom_u32_max(min(svc->num_dests, 32U));
+	while (start--)
+		cur = cur->next;
+	spin_lock_bh(&svc->sched_lock);
+	cmpxchg(&svc->sched_data, old, cur);
+	spin_unlock_bh(&svc->sched_lock);
+}

Regards

--
Julian Anastasov <ja@xxxxxx>




[Index of Archives]     [Linux Filesystem Devel]     [Linux NFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]     [X.Org]

  Powered by Linux