From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F8C8C433F5 for ; Fri, 13 May 2022 13:39:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1381519AbiEMNhm (ORCPT ); Fri, 13 May 2022 09:37:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381294AbiEMNe2 (ORCPT ); Fri, 13 May 2022 09:34:28 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C4BA310F0; Fri, 13 May 2022 06:34:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; 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=/2J4OgJGpc1Cb3jgc4qYyZLCbL55xwunzKlfyYoeZdw=; b=H5fwWH/CF298SAz3ALbH2c5z7A ciR7XVfqLP2R9vBz+MM7Tt7mIzVpVGIazQK/SwfeM03Y1CMw+rot1fB6EqfwRCpmMCQQ3db4Og1wr +oAMRjAqnC6qW6GJxg8gPUVzb1RuKngei/SmD1m8Rqcjv8kfpENiIDCoVIBAdx73tJrXHSNVzGJYe LjhjRPpxho7i5tuSUy8poYWdnn32VWijCYNYgtnFyJq/MkMMEIGFvfKSEH/F67s/49q5/+1VpduK1 SZhzVCB6wwKCqQzkqPS90HVCD6vA9M4EWHmUrceGEpByaycBWTM6Ct1rX8qPS6FNZTawPPDcnVbGK ZVKrN0DA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=worktop.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1npVQo-00Do81-V4; Fri, 13 May 2022 13:34:11 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id B3984981018; Fri, 13 May 2022 15:34:08 +0200 (CEST) Date: Fri, 13 May 2022 15:34:08 +0200 From: Peter Zijlstra To: Petr Mladek Cc: Song Liu , Josh Poimboeuf , Rik van Riel , "song@kernel.org" , "joe.lawrence@redhat.com" , "mingo@redhat.com" , "vincent.guittot@linaro.org" , "live-patching@vger.kernel.org" , Kernel Team , "linux-kernel@vger.kernel.org" , "jpoimboe@redhat.com" Subject: Re: [RFC] sched,livepatch: call klp_try_switch_task in __cond_resched Message-ID: <20220513133408.GI76023@worktop.programming.kicks-ass.net> References: <20220510165244.ikfh64ertnvodxb4@treble> <1bd15361edfd4db9fc9271d35e7bbe5edad1b87a.camel@fb.com> <20220510184213.l3gjweeleyg7obca@treble> <47440502-930F-4CBD-B859-3AC9BBFF8FC6@fb.com> <20220510230402.e5ymkwt45sg7bd35@treble> <20220511003331.clfvwfgpmbr5yx6n@treble> <20220511092433.GA26047@pathway.suse.cz> <78DFED12-571B-489C-A662-DA333555266B@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 13, 2022 at 02:33:34PM +0200, Petr Mladek wrote: > My concern is that klp_try_complete_transition() checks all processes > under read_lock(&tasklist_lock). It might create some contention > on this lock. I am not sure if this lock is fair. It might slow down > block writers (creating/deleting tasks). rwlock_t is sorta fair. Is it fair for process contect usage, but in-interrupt use will have a reader bias. That said; contention on tasklist_lock is a real scalability concern. Can't you use RCU here? With RCU traversal of the tasklist you can miss new entry (which should already run the new code) or miss exits (which will stop running code).