Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp748425rwb; Thu, 8 Dec 2022 02:23:59 -0800 (PST) X-Google-Smtp-Source: AA0mqf5L4JtxFMRmw7FbdT2Rf7w4X0E0xGqP0uZ0mhDuAvvqdK1JJIYsdMxllizZ8DVDcm7xXMR6 X-Received: by 2002:aa7:85d9:0:b0:577:53a9:836c with SMTP id z25-20020aa785d9000000b0057753a9836cmr8778955pfn.5.1670495039661; Thu, 08 Dec 2022 02:23:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670495039; cv=none; d=google.com; s=arc-20160816; b=Y9i3mwpl5ny23m+5f7IPBC37fxa+EOM0NlDCtpxWUoOu7fUSN44eUg2dKJHf/k0LPY NwmnQdr11CbXoL9Wrn5HXzyVOY3KwVFdf+JCUE6DMyiY3TGsGr/WmBv8pOWKHcetev+f e73TkDnTSWe0tOvDUvWBv+BmivJ8g4CD6WN4VsaK3OXHGEIXbCYb4HMIPKtMUFK4cn0x Jmmh79vFX2T0bxV62+1XP90IAVKbsRvtKWNs3ahsxKyB81EShRVYoqUAS6CBvIjO9ZcT eoyihfiW97qRPqU48zXgF803S7BwWqnwGsbJrUW+8GyvorPPzOe7zc3CsQuCgcqPg1wK oJtQ== 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=/ju8P8G7WnctS+qdq8ZzoznbqCOKX4msYY13PeOIM7I=; b=C2XsYcyXbEallaCRsA1lDTP0IWjgqKTT/LPxo7v97nrz3XnG92oGeoNqGFQzK63F8q KhcyggJXWD2tG8kJM9+dlxPa9i4d2LzusYRImBGmtloalkQIdhxizTpWdeojRDsI1U14 E576ej7BDukBM9HoZTpzOR7QYRuR0Q81kpg8llb9Iy5Ey3Adyf2HJe2SSTJVTksa0R/g G5TpINQYUKbfK7w92arvnLdW5BSkJPPB3YfSGY/Zw9Fth2eKi9HYHwlVKcCBxJE9px+k 84dPq/O/ElH9NOITgKcPCORfcVhpkgMlsXQDvK8tbCcDcqnDPE7DnnRpwfqem56OY+LF 3W0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=P8HFEZSY; 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 p11-20020a170902e74b00b001869347b0besi25504376plf.174.2022.12.08.02.23.51; Thu, 08 Dec 2022 02:23:59 -0800 (PST) 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=P8HFEZSY; 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 S230168AbiLHJiE (ORCPT + 72 others); Thu, 8 Dec 2022 04:38:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230070AbiLHJiA (ORCPT ); Thu, 8 Dec 2022 04:38:00 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 709242FC23; Thu, 8 Dec 2022 01:37:54 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id CF7BD61E42; Thu, 8 Dec 2022 09:37:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CE5F2C433D6; Thu, 8 Dec 2022 09:37:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670492273; bh=wYx2MO5YR6MseoVFegS6uhUtm5jWg22S6hWITNm5BM4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=P8HFEZSYo9pu0gboQpt9k8bdF2m9KCt5kF1ymZ/H5G65QDagLY+dzTTppFobUWtFv NSyEtoj1nMd8euSMT+6GAVXcfB1FjOek03/GBlFLmzduklr7BWi4RRO5eC3N41T8hZ S8wXuQ5t0JK8Mho1XXB7C7TrE3lXvfhcgfttHemOU+DpHQ7EEfAYnEdoe1UJfxc2sk A0kthGwJ7QKTrOdQEKS4JAViEvlv5C7trtTLedyaySjodl/liolDvHUDKIetuIujmQ OtA3wBq3T7SvvMSqE4Vr5E9l3CmP5aqn3WPTWF2rzOpjx6lsxj9l5FoaENZr+pgaE4 couMnWNctPAJA== Date: Thu, 8 Dec 2022 09:37:48 +0000 From: Jarkko Sakkinen To: Kristen Carlson Accardi Cc: dave.hansen@linux.intel.com, tj@kernel.org, linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, cgroups@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , zhiquan1.li@intel.com, Sean Christopherson Subject: Re: [PATCH v2 10/18] x86/sgx: Add option to ignore age of page during EPC reclaim Message-ID: References: <20221202183655.3767674-1-kristen@linux.intel.com> <20221202183655.3767674-11-kristen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221202183655.3767674-11-kristen@linux.intel.com> 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, Dec 02, 2022 at 10:36:46AM -0800, Kristen Carlson Accardi wrote: > From: Sean Christopherson > > Add a flag to sgx_reclaim_pages() to instruct it to ignore the age of > page, i.e. reclaim the page even if it's young. The EPC cgroup will use > the flag to enforce its limits by draining the reclaimable lists before > resorting to other measures, e.g. forcefully reclaimable "unreclaimable" > pages by killing enclaves. > > Signed-off-by: Sean Christopherson > Signed-off-by: Kristen Carlson Accardi > Cc: Sean Christopherson > --- > arch/x86/kernel/cpu/sgx/main.c | 46 +++++++++++++++++++++------------- > 1 file changed, 29 insertions(+), 17 deletions(-) > > diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c > index a4a65eadfb79..db96483e2e74 100644 > --- a/arch/x86/kernel/cpu/sgx/main.c > +++ b/arch/x86/kernel/cpu/sgx/main.c > @@ -31,6 +31,10 @@ static DEFINE_XARRAY(sgx_epc_address_space); > * with sgx_global_lru.lock acquired. > */ > static struct sgx_epc_lru_lists sgx_global_lru; Please, separate these by an empty line. > +static inline struct sgx_epc_lru_lists *sgx_lru_lists(struct sgx_epc_page *epc_page) > +{ > + return &sgx_global_lru; > +} Should be named by the thing it returns, not by the type. BR, Jarkko