Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp656381pxb; Wed, 11 Nov 2020 12:48:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJwY6f9+ILf9NqGqQ/+e0Zc6UIw3svJKKRQ+NgfEU51q187jJ7plEoE2+mGZVoC0Wp5NcLcV X-Received: by 2002:a50:8a88:: with SMTP id j8mr1459047edj.179.1605127693185; Wed, 11 Nov 2020 12:48:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1605127693; cv=none; d=google.com; s=arc-20160816; b=NVBVjzYyaQfWMBIvDOlAj48szDVnfHg5P0/a0/zd8j6e0V6H+x4k2ohzAtZep5fp86 gPOmVekZl9T36QOARn0oB2DOxRQ0VQMPyzj89RFiSdHVMnJUPlBeWDY2H8qtCNoKqcwc KxKb8NeOwKOVN0yHsPES/VmiXFG2COvjaQvgTSVJvUv6lH0Lq/7Vg1W+IKwXr9RoWWHO VQ4tIkT6UYVm+QS68lnO9+xKFAQaqsW8mfjTvF4zJwdRNlCYtN4xFm7MD3VHeDGE8SOB puHAuPTdTqcenePnoYpd7BwepQhy9uoSZQ6L7aQWKMdfqZSpUNUKIF7xMS647L/3CGsd VZXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=CsuP2ZbFV021yD83Asf/WJrsarPfzdmIq9MXLED49SE=; b=A9/xLAVoPS181me1AQSY3y5aAYTVNnM3j4swF1ya4385SqO6sVYBgVeDaauQwGFcNf QO/vBlVGw/pvEZPI+Id3xre8QmHMm7B2+zkkQk/bmxKfRqyZjcr6HiiJtrYt+S5i2XaQ rDo6/ciY0ORzNhVTFMBrx+1Lc1KFTLxRHMNZbz8L+8/v7ngxKF1/Cd1vu7rQB/OOWZO0 aoncDhgzmoLpAFEspBlSq9MmCXf3Q9PDnItppmxAGeYJfSEH9lNxn745rvXXp0r4FTH+ PwZTY2O6xRMnxKWjYztYAHMP5UtG9dlM0wpV7leNOwIjE9VDphCjAv022zCg4NFCi2Kk evsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=QF9Lp+Dv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p1si2385794edx.424.2020.11.11.12.47.49; Wed, 11 Nov 2020 12:48:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=QF9Lp+Dv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726433AbgKKUpI (ORCPT + 99 others); Wed, 11 Nov 2020 15:45:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbgKKUpI (ORCPT ); Wed, 11 Nov 2020 15:45:08 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8FA5C0613D1; Wed, 11 Nov 2020 12:45:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.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; bh=CsuP2ZbFV021yD83Asf/WJrsarPfzdmIq9MXLED49SE=; b=QF9Lp+Dv+5PrX67MKMP/B8Ri5v WnPV6mS+OhKhV1U72wkx3T64VjCFcm7V2HI4G7FzyyHU9uInlAIqTjutPsdBYLM3OdRRlLOsXV5/s hfnzgSqwDYUgqnnqY6OiG2pc6eugSLTBBj89ba1fqWiIpkPafPZ5pcwlN1JpwFCFCgsc1hgWNatpd 08yPCU5Lh9qGFj+2DZ1HzeEFzJhC+59QerfgRx2tzvZUvhjF78gAonDyzKShdXP0x7SXlNSnAMxOM istBiplwdwTvAISnRyQr5JA3d8mrkWQfbxNDDxbAdPhzO3k/k8eap/2fPZwCeZSEuZ1O1RZ+aIlvu kJw7TsWw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kcwzF-000766-PU; Wed, 11 Nov 2020 20:45:02 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 9EED9301E02; Wed, 11 Nov 2020 21:45:00 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 6A0352BCE962B; Wed, 11 Nov 2020 21:45:00 +0100 (CET) Date: Wed, 11 Nov 2020 21:45:00 +0100 From: Peter Zijlstra To: Paul Bolle Cc: linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org, Scott Wood , Valentin Schneider , Daniel Bristot de Oliveira , x86@kernel.org Subject: Re: [tip: sched/core] sched: Fix balance_callback() Message-ID: <20201111204500.GR2628@hirez.programming.kicks-ass.net> References: <20201023102346.203901269@infradead.org> <160508300397.11244.13967684821070428528.tip-bot2@tip-bot2> <6356963f376a0798e8c939f813c2efe05d32c6d7.camel@tiscali.nl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6356963f376a0798e8c939f813c2efe05d32c6d7.camel@tiscali.nl> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Nov 11, 2020 at 09:30:42PM +0100, Paul Bolle wrote: > tip-bot2 for Peter Zijlstra schreef op wo 11-11-2020 om 08:23 [+0000]: > > --- a/kernel/sched/core.c > > +++ b/kernel/sched/core.c > > [...] > > +static void do_balance_callbacks(struct rq *rq, struct callback_head *head) > > +{ > > + void (*func)(struct rq *rq); > > + struct callback_head *next; > > + > > + lockdep_assert_held(&rq->lock); > > + > > + while (head) { > > + func = (void (*)(struct rq *))head->func; > > + next = head->next; > > + head->next = NULL; > > + head = next; > > Naive question: is there some subtle C-issue that is evaded here by setting > head->next to NULL prior to copying over it? > > (I know this piece of code only got copied around in this patch and this is > therefor not something that this patch actually introduced.) It's like list_del_init(), it zeros the entry before unlinking it. queue_balance_callback() relies on this.