Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4894163iob; Mon, 9 May 2022 04:17:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKzvCTqpPZ2LAHup+II0ZpYxCqhXaAYM3a0in/cfOh0vp8y9B7Rz61BXVHbask9AM7Qgvi X-Received: by 2002:a17:902:c14a:b0:15b:9c29:935a with SMTP id 10-20020a170902c14a00b0015b9c29935amr15769660plj.2.1652095035590; Mon, 09 May 2022 04:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652095035; cv=none; d=google.com; s=arc-20160816; b=X3gVp50F8zfMb31SgGAniJPCazbD7YFUtHDxdONCfM6ntCuWcllbyGDEgyWUqyK4wz AatV8Ve2tOrcgnTv16oyAuWpf9sYewRx0/fh59XhMLHXC5tDXKhFo6gPwLnFDraDDHqS zmRebuUkxHTY3qKRE5xACHQ2Z6WuXmPwyRib2lLbt3zfxjy5/JKUK7xVhfN84A/PEQ8j 72OE8z584OUJ58Lvo9NtnJJZSoojGHw/RgyN7Iqy36EAcnSJKvbA+K+/8FiMYbNr+ZkK PuCrSjoEu+chhiEVHqCS0btJ0j5pRbfsxquos7nGD2+YETnTr1/7/EdJk+CzjVVXlo3Z nFcQ== 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=AIZdv4JTMV0tgr/rdLMJ0LJYPCllAVNxOvYbroKKttk=; b=jRP6kUdm90y36FArmfGV/JF+qtNcg+MkkdkLrgQgaYLVQhfCcD2Ba+BlC5jMjLBNj5 sKuWaY2FXMITWX9GVTJYjVJByE1ohWAvCHdOGY11gGfiGVYliLVTpaLt7NB6irg2vsY3 SmMoCGuxagWctKNiEGvKmfOmVUVRYuzfqVyAGlEZWEdeeJ6jcfubUuAylghlVM5sL438 ncTfgEU6BgrVEtMDlLGGnFNGziFjH4DVjyUKpapiaNxnRGYGvkIJpUbEzcFhLskNJpC2 j1EXkViRQoDa3jQ5b+CLAP7sJ81NWo+O4pPsiY3jHowUmQFFj+PcJRosNAUiCyMqiRY3 qP9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=EhpxzdTq; 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 j191-20020a638bc8000000b0039d3ce3030bsi13751647pge.553.2022.05.09.04.17.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 May 2022 04:17:15 -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=EhpxzdTq; 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 0E5DB24D623; Mon, 9 May 2022 03:27:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232672AbiEHUpM (ORCPT + 99 others); Sun, 8 May 2022 16:45:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232305AbiEHUpK (ORCPT ); Sun, 8 May 2022 16:45:10 -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 CC5FFAE58; Sun, 8 May 2022 13:41:18 -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=AIZdv4JTMV0tgr/rdLMJ0LJYPCllAVNxOvYbroKKttk=; b=EhpxzdTqTZVDEObCACw4pmLjm/ CXj0vEyT5BCwwOo6auvsgFAgrALxJoWM9Hf5JJFIJ1NAOBGdDDUJ8gG3E6BZYmC3HlbHzvUuS7cni 8EuKaD9bWXzUWyTuu7RsG9bnPpETLSeF8UpIxIQdeUrUcnFT06/LQOF5bPdLdAZOGAMQjOUAWoyyi byeqBh248UwyLwqZ7yJVX33xq8E/lozf1vd9ukWF5+xvRkeTdn++UqtUlABdJraGccaRMWiDYo8rt z3e5xEO0z4yDfqrNKH5FAA1PwtYp9KjsaIY6oZDoTvrAzMuFfs/r82XTkzg51Rloid3yw4tfZjmrR j579v5cQ==; 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 1nnniA-00CMYT-6R; Sun, 08 May 2022 20:41:04 +0000 Received: by worktop.programming.kicks-ass.net (Postfix, from userid 1000) id 3ED26980D51; Sun, 8 May 2022 22:41:01 +0200 (CEST) Date: Sun, 8 May 2022 22:41:01 +0200 From: Peter Zijlstra To: Rik van Riel Cc: Song Liu , "song@kernel.org" , "joe.lawrence@redhat.com" , "jpoimboe@redhat.com" , "mingo@redhat.com" , "linux-kernel@vger.kernel.org" , Kernel Team , "live-patching@vger.kernel.org" , "vincent.guittot@linaro.org" Subject: Re: [RFC] sched,livepatch: call klp_try_switch_task in __cond_resched Message-ID: <20220508204101.GB76023@worktop.programming.kicks-ass.net> References: <20220507174628.2086373-1-song@kernel.org> <1b7f0b76b6060b6a0ccd04fec2be6c0323907c8e.camel@fb.com> <36BA01F0-F2B7-4290-AB23-E61989262AB3@fb.com> <901aa9a48ef02eeec73dedf051dd0b14436ac22f.camel@fb.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <901aa9a48ef02eeec73dedf051dd0b14436ac22f.camel@fb.com> 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 Sat, May 07, 2022 at 07:18:51PM +0000, Rik van Riel wrote: > Huh, I just looked at that, and the x86 should_resched() > only seems to check that we _can_ resched, not whether > we should... > > > /* > * Returns true when we need to resched and can (barring IRQ state). > */ > static __always_inline bool should_resched(int preempt_offset) > { > return unlikely(raw_cpu_read_4(__preempt_count) == > preempt_offset); > } > > I wonder if that was intended, and why, or whether > the x86 should_resched should also be checking for > TIF_NEED_RESCHED? No, it does what you think it should do, you're just getting confused by the inverted PREEMPT_NEED_RESCHED bit :-)