Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1044955iob; Fri, 13 May 2022 20:54:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5cXB4FSp0/AagOyyWm2LUjx0bX2Jt4j3grfwvfC0+CMHTDSPp3smprQ+QrpvIYKb76tDy X-Received: by 2002:a05:600c:42c3:b0:394:7ef8:41c2 with SMTP id j3-20020a05600c42c300b003947ef841c2mr7045656wme.50.1652500448261; Fri, 13 May 2022 20:54:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652500448; cv=none; d=google.com; s=arc-20160816; b=xrEiUnc5fCia3hcDVwH0TWHLI02W7zBBlLMcloCWvotTCRpYcrdarc6yS0FMbCbMFK 4lgI6E8v1KgahxNbRDndlkq1zRoNRQEnjjPUlGwfZj8SuDsOJ4w+wzrJbBvh7TmP7h/v mjkd47yoltXiVp7g2ELZw1co9qOs0UWIm5wBXaiQDPSpSxYps1gWuooDwG9NGmm9AiTX uAbRAdHNVVL+ILHDj9yImKrCO/VCoV2COJbEiAPJfjNorYJLwhWFuqWESjV/L/vuO89H atFPCbspqpXnS52pYBDL8V0xRrbb1r8eXCCieTPzF3EQYE8HAIXtQ0INYS/GHFXac9Q3 rtrA== 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=/2J4OgJGpc1Cb3jgc4qYyZLCbL55xwunzKlfyYoeZdw=; b=FVkKNY4kTy0UcXqUdCPqPcT5LtRFlz9J3Cj4PqS9PuMZy38p6COvv2LnIMMgAq1GUQ vJT0fkJAETkvSuMjO5kfOR3WOSTghdSCcFkigM9zlgoP96tKZi6NqgZGtPuDx/33ULtY 9SAq8wdmYzyXTtTswFq/DNS/xkaQDRoeADVhR1j+3UfvguqVUwkl4/4xYdT/Vmqc784Y eOtUvon5pKMdvvhukEuaz76GnnGlVx28IkfEOIUze+9QDLlhE77/0QpH7TOpamIfz/K/ GgOLfvRf21q+uZiQFyS5Zc+6SYsDzOCUvJ5kQy67BYUlKtIoF7tV2mPsXTrSjrvluzDG Y7TQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="H5fwWH/C"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id z17-20020adff1d1000000b002041389fb7bsi3593143wro.68.2022.05.13.20.54.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 20:54:08 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b="H5fwWH/C"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 45631ED7A2; Fri, 13 May 2022 17:26:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345181AbiEMNhm (ORCPT + 99 others); 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: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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).