Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp4853908ybf; Wed, 4 Mar 2020 12:02:27 -0800 (PST) X-Google-Smtp-Source: ADFU+vuBTKX7xeUL7C5iJ4c3RgcBIWdSQgAnWK0oIUZZu1895VEqbaJf13H/0kkVl8GgPX+kL3pN X-Received: by 2002:a9d:664d:: with SMTP id q13mr3897163otm.30.1583352146614; Wed, 04 Mar 2020 12:02:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1583352146; cv=none; d=google.com; s=arc-20160816; b=p+o1x41faIncsWWIXPQz4ecK7dAbCmmLOdGpfnd+IvqKcetL0y4NlNAPoUHbfclDST DhlnPVQMHo3iwoX9yTo751edFIJMA1wegTDgudNj5NE8dz4uDdHz++Lf0TPa26/rUTS9 vVOsENSHMMsSS6hsXaVNZTxAsJtv8e9r6/Xqg8U36WyqlkZNlh5G2pU4pl5DuLDvYLtW B+Za6Xmroh4RAJHWEOZjKK+SIY334yX1Kj/7VC7PfY4rSXgvbO9gDc/8e6atg6dIlwx3 CAg6t1mctjQccyo2k+B8dqsX7c12u+ZzfNuOU/woydrBLI5QuiHeHdcKwyWx8Nz3cof2 bBfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=jCimalbE2jYpfH4879zSiUOcnl6Kz01wPeUdfMtVVgc=; b=lDpmcdTpzt5LKQdXQGuzefO9KFhsXzep7JFILLXo+PnLorUIt+6oDYkBhLwYw21f0H kdUCnEpgYJjRzahOqcbqsnCzsIUnFtNwJ+Vtt0iE2Dd8RIVMjwm1gwXJJuau0M6Vy2RP glrimCSFdfuh6JgABxM8nyFjL21XWUIr2/uNX/5t6W9bbJvQjklESpzDCM+JcNnLN3ou HFREeAIl85XClDMFTDVrVj9bgnHij00ylb2abshZN7t6QVvEedJ0KOrzhH1ZvANcEQeT y4ySYMgmKXgeFMT2RRw+lKNj6Z0+b5tuZJXiRUNN05naXjNhJJB3OakLLQELU8pslgD+ 9lWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j10si1995135otr.268.2020.03.04.12.02.13; Wed, 04 Mar 2020 12:02:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728955AbgCDUB7 (ORCPT + 99 others); Wed, 4 Mar 2020 15:01:59 -0500 Received: from foss.arm.com ([217.140.110.172]:39010 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726561AbgCDUB6 (ORCPT ); Wed, 4 Mar 2020 15:01:58 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1700A1FB; Wed, 4 Mar 2020 12:01:58 -0800 (PST) Received: from e107158-lin.cambridge.arm.com (e107158-lin.cambridge.arm.com [10.1.195.21]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B7D8F3F6C4; Wed, 4 Mar 2020 12:01:56 -0800 (PST) Date: Wed, 4 Mar 2020 20:01:54 +0000 From: Qais Yousef To: Steven Rostedt Cc: Ingo Molnar , Peter Zijlstra , Dietmar Eggemann , Pavan Kondeti , Juri Lelli , Vincent Guittot , Ben Segall , Mel Gorman , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 1/6] sched/rt: cpupri_find: Implement fallback mechanism for !fit case Message-ID: <20200304200153.c4e2p7qnko54pejt@e107158-lin.cambridge.arm.com> References: <20200302132721.8353-1-qais.yousef@arm.com> <20200302132721.8353-2-qais.yousef@arm.com> <20200304112739.7b99677e@gandalf.local.home> <20200304173925.43xq4wztummxgs3x@e107158-lin.cambridge.arm.com> <20200304135404.146c56eb@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200304135404.146c56eb@gandalf.local.home> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 03/04/20 13:54, Steven Rostedt wrote: > > If we fix 1, then assuming found == -1 for all level, we'll still have the > > problem that the mask is stale. > > > > We can do a full scan again as Tao was suggestion, the 2nd one without any > > fitness check that is. But isn't this expensive? > > I was hoping to try to avoid that, but it's not that expensive and will > probably seldom happen. Perhaps we should run some test cases and trace the > results to see how often that can happen. > > > > > We risk the mask being stale anyway directly after selecting it. Or a priority > > level might become the lowest level just after we dismissed it. > > Sure, but that's still a better effort. Okay let me run some quick tests and send an updated series if it doesn't return something suspicious. Are you happy with the rest of the series then? > > There's another 'major' problem that I need to bring your attention to, > > find_lowest_rq() always returns the first CPU in the mask. > > > > See discussion below for more details > > > > https://lore.kernel.org/lkml/20200219140243.wfljmupcrwm2jelo@e107158-lin/ > > > > In my test because multiple tasks wakeup together they all end up going to CPU1 > > (the first fitting CPU in the mask), then just to be pushed back again. Not > > necessarily to where they were running before. > > > > Not sure if there are other situations where this could happen. > > > > If we fix this problem then we can help reduce the effect of this raciness in > > find_lowest_rq(), and end up with less ping-ponging if tasks happen to > > wakeup/sleep at the wrong time during the scan. > > Hmm, I wonder if there's a fast way of getting the next CPU from the > current cpu the task is on. Perhaps that will help in the ping ponging. I think there's for_each_cpu_wrap() or some variant of it that allows to start from a random place. This won't help if there's a single cpu in the mask. Or when nr_waking_tasks > nr_cpus_in_lowest_rq. Still an improvement over the current behavior nonetheless. The other option is maybe to mark that cpu unavailable once selected so the next search can't return it. But when do you mark it available back again? Thanks -- Qais Yousef