Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2148167rwi; Sat, 15 Oct 2022 08:40:17 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4kQdUGkKWgTp5Mwvu7G7Wp/U0eAB3dEVutIEuJ+t9Mue96V9N37J5ZbpwLQjPIONxoXdb+ X-Received: by 2002:a17:906:dac8:b0:741:545b:796a with SMTP id xi8-20020a170906dac800b00741545b796amr2373984ejb.240.1665848416788; Sat, 15 Oct 2022 08:40:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665848416; cv=none; d=google.com; s=arc-20160816; b=VlahDRrcY8PgYjLET8CcGeLzT9WJdq+tThHqqSbUvofh8G7LkugYGOLoxvhNWq/t4d 3q4HKzVkvU6HcqhxsGjQMK9cV2nW0n2Y4A8YpIwsjkLJVFm0S9IVbgRzNicYZTwF6Gt0 QhuRkOiD0SHmKI9od84Ynwvgfs6RkV8HIUJAqzpC+7C/JtuRdKIUFlT2ZL0YYmp1ymB1 LURctn7iXO23Sbal95YNZ/sJnMdGv6HeaeXUab4uUsJb9M7woSJQaupgfjaWClY2p0Pi VHmb/8WPfOcbr7mpbE3Q6Ua7VTVW3UY9rj6T320heH63RagKd7nsU2GBTT/STEKiJ4Nk x/Cw== 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=Oq2KYIbNYR7Y53auqwuF1eehcG0wTStRSZCTq53nCf4=; b=Bvcnmu8dH6lZ/wXVi2UTmslTh9NAJqQc3bKoXy3ejmfpzvec8Ej5TR9Ft8XcxR2zM0 eLzvrEHJURLqtjDHULld5JYMmVuUGcliAdE3JO6/Y0dWD2wuQ+71bfmq3EoA89ZQTUBU EneS2TL1PxQbfnsa38yn6sC23/TqAjcwqDEAUsMNZw4XXAieR6cSWpI9fmE6DXC+ops8 strrjRHoprfctAHFrdQdbbISW1iolH3l9u5+KhHwaV1s9zM97tpzT+j3t8bzQeG3eAlY rN0wSsZrEewsshDSAn9eShbR41KN6F7+EXHg8Xlte5fr9XF9LTGdQMCdAiTpoHYBOUop CxBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=wIN7AP4j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg3-20020a1709072cc300b0078d8bd255d4si3797338ejc.949.2022.10.15.08.39.50; Sat, 15 Oct 2022 08:40:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=wIN7AP4j; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229732AbiJOPKO (ORCPT + 99 others); Sat, 15 Oct 2022 11:10:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229703AbiJOPKM (ORCPT ); Sat, 15 Oct 2022 11:10:12 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A5E527156 for ; Sat, 15 Oct 2022 08:10:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.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=Oq2KYIbNYR7Y53auqwuF1eehcG0wTStRSZCTq53nCf4=; b=wIN7AP4jTTDWAmAtKuTey8i5r8 POcT/pw2MLRsOSgQ6oYlHCt/n9ToSAdq/vWbpHc1rk47bos7RslGgCwMHlw80cq8neGO/xFXtWvso A9D8JEHscfAe49Tc3UFgLcEw3uuw7xuxt54iIXUm3Cb3ZoxH2TYucPrHmoVByIpEDGf3rDqf17TMA 9tv0RXMoH8XxEwmFIYzEAnzrku+2P5iHyYcZi4AACuLo8scn3hVMswDaoCPlV+g6sdLv3OzR1x44k rGh5n6uhhEMStbNWHxLps+4BgToPYXqyPtCu5WPkZGgycCe0r8nUQPohvpit9vY8NCg9ioWV0w77n n90i3dig==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by casper.infradead.org with esmtpsa (Exim 4.94.2 #2 (Red Hat Linux)) id 1ojind-008S7W-Pg; Sat, 15 Oct 2022 15:10:05 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id AF39130004F; Sat, 15 Oct 2022 17:10:00 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 990D8201FD678; Sat, 15 Oct 2022 17:10:00 +0200 (CEST) Date: Sat, 15 Oct 2022 17:10:00 +0200 From: Peter Zijlstra To: Connor O'Brien Cc: linux-kernel@vger.kernel.org, kernel-team@android.com, John Stultz , Joel Fernandes , Qais Yousef , Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , Will Deacon , Waiman Long , Boqun Feng , "Paul E . McKenney" Subject: Re: [RFC PATCH 07/11] sched: Add proxy execution Message-ID: References: <20221003214501.2050087-1-connoro@google.com> <20221003214501.2050087-8-connoro@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221003214501.2050087-8-connoro@google.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE autolearn=ham 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 Mon, Oct 03, 2022 at 09:44:57PM +0000, Connor O'Brien wrote: > @@ -703,15 +707,28 @@ __mutex_lock_common(struct mutex *lock, unsigned int state, unsigned int subclas > break; > > if (first) { > + bool acquired; > + > + /* > + * XXX connoro: mutex_optimistic_spin() can schedule, so I'm thinking it might be better to remove that schedule point for PROXY_EXEC instead of doing this. Getting preempted right after acquiring a lock is less of a problem with PE on than it is without it. > + * we need to release these locks before calling it. > + * This needs refactoring though b/c currently we take > + * the locks earlier than necessary when proxy exec is > + * disabled and release them unnecessarily when it's > + * enabled. At a minimum, need to verify that releasing > + * blocked_lock here doesn't create any races. > + */ > + raw_spin_unlock(¤t->blocked_lock); > + raw_spin_unlock_irqrestore(&lock->wait_lock, flags); > trace_contention_begin(lock, LCB_F_MUTEX | LCB_F_SPIN); > - if (mutex_optimistic_spin(lock, ww_ctx, &waiter)) > + acquired = mutex_optimistic_spin(lock, ww_ctx, &waiter); > + raw_spin_lock_irqsave(&lock->wait_lock, flags); > + raw_spin_lock(¤t->blocked_lock); > + if (acquired) > break; > trace_contention_begin(lock, LCB_F_MUTEX); > }