Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp900358rwb; Fri, 23 Sep 2022 05:49:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7B/K9mSoNBpHdVYzJnLyX8q3vAMtLEzNAsAdIVJ27fvdUlBpYL5DGAdt0JVTJehTzEMs30 X-Received: by 2002:a17:907:a0c7:b0:77f:a9d2:9be2 with SMTP id hw7-20020a170907a0c700b0077fa9d29be2mr6761726ejc.352.1663937369148; Fri, 23 Sep 2022 05:49:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1663937369; cv=none; d=google.com; s=arc-20160816; b=ht+fE+LG/B7TplOXSjLAmM2cFmdNay4fHYTFtiy3jW+bvea+GJrYkAx+yTwdFnIPFx 02V7WKEjVwPHm22xkQUMmO5sN04mVfH+Wmp5abi/kSBmb+6tAVzb3NnE3xX8SmZ6B9P6 q7wRG71dcT0BG5ErjhYEgLqWLGfMj4ipBNErnNcsUSftO3cfBx+Rpfe+UFzx+3hvDYEa aD9aVIxeBR1ovTUrLhmJ8BvXrdxlS+1MF71EPT3c0zr8oEx+U2pH5gyWrdzeL6CvaVY4 f4KHVZNbUdBdOpYnuDN/emQlTWzx2rINckKVEtvD1/ybSDP8bsY8jos3rYtJQEEMlB2p oXZg== 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=NU4etyuWJ4kLi1J2DiMnueBUHQtE3/SzMXx6rNtUbYc=; b=tsdIQoxBDb24umtmLxy0Y8ktVLUTqVkwWsYOa84a1aRitgWdJRb053F+6EvbK7XIHN qymZLRTFz07d9bWeo9hG+6AoWaB0MohsHWKVUH4T9tSciUbs8vGWg2VqI8hm0Oh0BXlS HnAltvodUEgOuP9j5xhIqwpux22qT3J+J5LDYGc4ucT295CRUpCnGpcEf7JdZ24sd/kH 6WSzXqn4S/j52PwBJmEQMM2GbG85E3fgQ4acwl2cJQPheCe9sOe1qROivpp2Ub0hrr9L uaOAfisQ7FykFeJZHDgnF7c67/cu8yNbA/UVZ4oWPAR5wd8uQ68GL6tm2X7i/tbfHvwR 5tIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=rBQix+E3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id gv26-20020a170906f11a00b0077ef3eeca17si6910844ejb.155.2022.09.23.05.49.03; Fri, 23 Sep 2022 05:49:29 -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=@kernel.org header.s=k20201202 header.b=rBQix+E3; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231168AbiIWMhX (ORCPT + 99 others); Fri, 23 Sep 2022 08:37:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230110AbiIWMhW (ORCPT ); Fri, 23 Sep 2022 08:37:22 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 452FD12870D; Fri, 23 Sep 2022 05:37:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id E9E90B82E2A; Fri, 23 Sep 2022 12:37:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4C5DDC433C1; Fri, 23 Sep 2022 12:37:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1663936638; bh=6ufS71cwq8f+QgKYS3c0Olp77739jrQ+6Uk+8KSx2gI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rBQix+E3G0MhqACZVF5fEWLWcnppHWANoio3N57g52jL6ckZ77Hhr+C6psPtJHo1y imZIMItciRJPvS/iOW8pHOv9/rzRuF7c2amXKeYG5Dn/ci+rjZGsA1iydRTlB2iYwc fU0gjLwN6c9Hz3FlQSJK+qLpMS/WuvDTlLt03WN+Kv40Em+ptYZ5fRWzvg4Qc+bOMy 8fZfXkye4snjBqfgzlSS8FJG9FdsYc3C3OcZvwbsJCv+hNNfVPYCCuusKdzr9TVyYf lQL+eFXlRX44FM/KTVciYro2A0QBgJwDaX/Cg7Xpz4e7cn3b/yhFv63RK6Mc+t856s wcunbZjsiuHzQ== Date: Fri, 23 Sep 2022 15:37:14 +0300 From: Jarkko Sakkinen To: Kristen Carlson Accardi Cc: linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, cgroups@vger.kernel.org, Dave Hansen , Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , Sean Christopherson Subject: Re: [RFC PATCH 01/20] x86/sgx: Call cond_resched() at the end of sgx_reclaim_pages() Message-ID: References: <20220922171057.1236139-1-kristen@linux.intel.com> <20220922171057.1236139-2-kristen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS 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 Fri, Sep 23, 2022 at 03:35:25PM +0300, Jarkko Sakkinen wrote: > On Fri, Sep 23, 2022 at 03:32:43PM +0300, Jarkko Sakkinen wrote: > > On Thu, Sep 22, 2022 at 10:10:38AM -0700, Kristen Carlson Accardi wrote: > > > From: Sean Christopherson > > > > > > Move the invocation of post-reclaim cond_resched() from the callers of > > > sgx_reclaim_pages() into the reclaim path itself. sgx_reclaim_pages() > > > is always called in a loop and is always followed by a call to > > > cond_resched(). This will hold true for the EPC cgroup as well, which > > > adds even more calls to sgx_reclaim_pages() and thus cond_resched(). > > > > This would be in my opinion better: > > > > " > > In order to avoid repetion of cond_sched() in ksgxd() and > > sgx_alloc_epc_page(), move the call inside sgx_reclaim_pages(). > > > > This will hold true for the EPC cgroup as well, which adds more > > call sites sgx_reclaim_pages(). > > " > > > > This way it is dead obvious and is better description because > > it enumerates the consequences (i.e. call sites). > > Forgot 3rd call site: sgx_reclaim_direct(), which is used by > SGX2 ioctls. The call sites of sgx_reclaim_direct() do not > call cond_resched(). You should address why adding this call > to those flows is fine. Ofc adding a parameter to sgx_reclaim_pages() for cond_resched() call is other option (not emphasising either option). BR, Jarkko