From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754667AbbAVVIQ (ORCPT ); Thu, 22 Jan 2015 16:08:16 -0500 Received: from ja.ssi.bg ([178.16.129.10]:46846 "EHLO ja.ssi.bg" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1754475AbbAVVIO (ORCPT ); Thu, 22 Jan 2015 16:08:14 -0500 Date: Thu, 22 Jan 2015 23:07:48 +0200 (EET) From: Julian Anastasov To: Chris Caputo cc: Wensong Zhang , Simon Horman , lvs-devel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/3] IPVS: add wlib & wlip schedulers In-Reply-To: Message-ID: References: User-Agent: Alpine 2.11 (LFD 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, On Tue, 20 Jan 2015, Chris Caputo wrote: > On Tue, 20 Jan 2015, Julian Anastasov wrote: > > > + (u64)dr * (u64)lwgt < (u64)lr * (u64)dwgt || > [...] > > > + (dr == lr && dwgt > lwgt)) { > > > > Above check is redundant. > > I accepted your feedback and applied it to the below, except for this > item. I believe if dr and lr are zero (no traffic), we still want to > choose the higher weight, thus a separate comparison is needed. ok > + spin_lock_bh(&svc->sched_lock); > + p = (struct list_head *)svc->sched_data; > + last = dest = list_entry(p, struct ip_vs_dest, n_list); > + > + do { > + list_for_each_entry_continue_rcu(dest, > + &svc->destinations, > + n_list) { > + dwgt = (u32)atomic_read(&dest->weight); > + if (!(dest->flags & IP_VS_DEST_F_OVERLOAD) && > + dwgt > 0) { > + spin_lock(&dest->stats.lock); May be there is a way to avoid this spin_lock by using u64_stats_fetch_begin and corresponding u64_stats_update_begin in estimation_timer(). We can even remove this ->lock, it will be replaced by ->syncp. The benefit is for 64-bit platforms where we avoid lock here in the scheduler. Otherwise, I don't see other implementation problems in this patch and I'll check it more carefully this weekend. Regards -- Julian Anastasov