Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp4813796yba; Tue, 30 Apr 2019 04:57:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqwJRWqLnvFf1mIUs4KdhEh07meJ2YxJcyjebD3bJ7rQy9HA4mAto51NddUqDy7hTSE02wjr X-Received: by 2002:a17:902:581:: with SMTP id f1mr69196320plf.304.1556625467723; Tue, 30 Apr 2019 04:57:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556625467; cv=none; d=google.com; s=arc-20160816; b=pa4iJOewcKkwaU8lmUcjunzYRT+ISSeGOPOsczAK+ZXHIdHEylQDqnf/QvW20hooBV R/Xlnm+TX0Lfvh+cr7iM9k+oKVtYaOYNbE9QnlJlXrNvVKRE7LM8CTubiQG2T23oyahe dqRE6KZCGlmklAulrxJlkGgdYPqmf/1rJVGSqQWw5GKe0PjFTv20ZmIQ+OPWwFFiU8Iy zDTB0CacTxHPw7/vlxZNNqk54c+fjkUaVj3ccQIH/GKSoFCAsG5M7gBVjcmK6N8+jV7b cV/PxRvpQxVj/md41U/GheSM99g1G7ONdniygQuFXtNoCGUs7DxxJBwtZTj1eOFwB6gG Tbig== 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:dkim-signature; bh=1FRlbeq74rKv2BVig4MgSeofWTqiuNAZ7kl/vVWV7YQ=; b=BCmJ1EAIko50NasD5+6xB9o32ipbsHYynYk7ppahtxObmsK8br6utjd0nZ2bZXbwDH 66pMHOw5GJFcGAE2P0BS1qMoHPDDBzecEcEPnK+WaUua5xEGWlyhtwUR3o6GaYW6c+ly 4Njlk3O6a3Wo2bpKPof2Bk/ucCZRjTdP73XNFYYfUvH1HW57DLtUY2sAIieLZ5IuF9Wj vDqsJ1pWDcaC1el092jC8FAk19/NoB6z2n0tik7NsqA4RdTzQO5IfJpeUvk8hne7WFeM 5bjyCKJjclB6k9+iyppHeJ+0CZvtrhBxt3fY7vGGJagHSvqxOpV/SZ16HPtVHx9t3JMi 1XbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="uifRx/IH"; 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 i9si11554631pgs.402.2019.04.30.04.57.31; Tue, 30 Apr 2019 04:57:47 -0700 (PDT) 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; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b="uifRx/IH"; 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 S1727660AbfD3Lz4 (ORCPT + 99 others); Tue, 30 Apr 2019 07:55:56 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:49236 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727549AbfD3Lzy (ORCPT ); Tue, 30 Apr 2019 07:55:54 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=1FRlbeq74rKv2BVig4MgSeofWTqiuNAZ7kl/vVWV7YQ=; b=uifRx/IHUn5YjaDIjS3gB7PtR 6o1P8LCjJUH8ZoSAFUqjkLns23nKJBnAr5zwqjWk0AQSpkCxHTdLgR6KA0mmac340IsQdi34n29Kk WtTfSus8BLgzK/SiP5D7xzx+ma0Zmie4XDJGtjf2eBlKlYUtq0/HpSuSEP/hv3YkTeOZrV1WNX19w KT1nl5Wk8Qa2Z2vNndUE/9mBMwFfyJRB+j0BoLqHV7jnYQDkOv0n5GjA49JcWrVtk9wv103/TDedy I8KfwOdEO/GY139tcBYwMGyO8ZtPALn8U3f0SbZsZuNH/9MWbEcXrQoDEE3JrXxFjv0X91OB3WTox f0y0zDjEg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hLRMX-0000eR-K8; Tue, 30 Apr 2019 11:55:53 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id A6A6F2139B636; Tue, 30 Apr 2019 13:55:51 +0200 (CEST) Date: Tue, 30 Apr 2019 13:55:51 +0200 From: Peter Zijlstra To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, andrea.parri@amarulasolutions.com Subject: Re: Question about sched_setaffinity() Message-ID: <20190430115551.GT2623@hirez.programming.kicks-ass.net> References: <20190427180246.GA15502@linux.ibm.com> <20190430100318.GP2623@hirez.programming.kicks-ass.net> <20190430105129.GA3923@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190430105129.GA3923@linux.ibm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Apr 30, 2019 at 03:51:30AM -0700, Paul E. McKenney wrote: > > Then I'm not entirely sure how we can return 0 and not run on the > > expected CPU. If we look at __set_cpus_allowed_ptr(), the only paths out > > to 0 are: > > > > - if the mask didn't change > > - if we already run inside the new mask > > - if we migrated ourself with the stop-task > > - if we're not in fact running > > > > That last case should never trigger in your circumstances, since @p == > > current and current is obviously running. But for completeness, the > > wakeup of @p would do the task placement in that case. > > Are there some diagnostics I could add that would help track this down, > be it my bug or yours? Maybe limited function trace combined with the scheduling tracepoints would give clue. Trouble is, I forever forget how to set that up properly :/ Maybe something along these lines: $ trace-cmd record -p function_graph -g sched_setaffinity -g migration_cpu_stop -e sched_migirate_task -e sched_switch -e sched_wakeup Also useful would be: echo 1 > /proc/sys/kernel/traceoff_on_warning which ensures the trace stops the moment we find fail.