Message ID | 20221111183532.3676646-11-kristen@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp905179wru; Fri, 11 Nov 2022 10:37:35 -0800 (PST) X-Google-Smtp-Source: AA0mqf4S6foC8F3DxwdPoKcf8Tm3ojqh8kwHQBjr+7a137Ez+8FVQy7UKgIZhWQP31O9IU+iQBDm X-Received: by 2002:a63:1e05:0:b0:434:911a:301 with SMTP id e5-20020a631e05000000b00434911a0301mr2866089pge.50.1668191854875; Fri, 11 Nov 2022 10:37:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668191854; cv=none; d=google.com; s=arc-20160816; b=T0vn/+aG0UyuC+gVdzzvwEiLClT41fK4ezjo9+S87FlrUT0YUB6tvrBlbTVdEtWZIo Scdlnv4v7Vkf709gqGaWIaiIUkW9QLMIhUEuE3lGNmbPg5JbiVSdTA1SMxtOfXERxx+s 00qxUhI06A70PH5anV6AzhSjwB3r+tlEDwOme7lJ/plHzbfAWAUHocKeWrUKiaq8qbK2 SK6zQjU7MoSLAEmCWY8Vb/i5xqf/leS0Gp+gckNbIUrq4mg4q3Gz51tF5hf6hsaUutDB JPKEd9aA7uz10pNTAMeFEWiV1cLPeZ1SKMi3+1VuNQpcZsswBYH3SVYTfd5FOVMPKtpt WfPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=twJnbtCWO+Cip0TQ0WV/NOgsOOUBiJPnkOptxBiZTw8=; b=Ke2MmLZuYleJ8qch/QJoakjNPZ0eS85GFhvuLSQ4Zf9BkxAC5yJrccDqAl4MBu+1ie y+EJ5DlH9KYJbyuOr/xzJJwekmQcOtRrm8VQkgGN/eJkjPeDF8uU194vgoLVnS4VAo5V /SBjP+1OwA8mSXFmU3rms2uEf0zm/aRfxOfd7b7Zc/lGRubj3stbOhabrm5X/pOxVjja Ho1a8XskP+rr0hnDz43botWTFFHOnNJwxncDxpSCY4J0YlqgUVsdtdiRKW4Z4bVIIGV8 KfkkPPWyGVq07RBpf/N1kIHY9BDUqVw1Q0nZs1U4I/8+byOlZ6QLRCShMiI2UW4npGSj vGBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=moE5q5ze; 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=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h18-20020a170902f55200b00186b3cb9b80si3516208plf.354.2022.11.11.10.37.20; Fri, 11 Nov 2022 10:37:34 -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=@intel.com header.s=Intel header.b=moE5q5ze; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234491AbiKKSgw (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Fri, 11 Nov 2022 13:36:52 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37234 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234057AbiKKSgB (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 11 Nov 2022 13:36:01 -0500 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8DC567879A; Fri, 11 Nov 2022 10:36:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668191760; x=1699727760; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=auEkniWHXFa2fE8QomwYSOXBkMl7XCSjIOySc76haUo=; b=moE5q5ze8HRfh2Io/10CiATX4QuLtmCZ9WUGz5eTpMe6kB/wOIsPq+WB U/UmBWrsSRMys87dGMDh24avstK8wJ5z6a4ZT079FDDoyyinPiX+Fe+0F sP98tgIkmDERihHKBVt/odKR2/Wz3h6rWmsjg4xQlGf1maJ7tQnAw/4lh r40zxA1+d0apprXFTYBRK7vFqL+CNrIbv2jWcmj74x4iS6RmOBWus4hJr dOVHHOhbVR5fj631MvmkeP8sCUWKzc7JHtlH9a1aWlD4ElJeg4Ciz1z4Z BpRXTP9Yi+0RoU9YqYu8jvGo/Oyi82Xp0EIoPZwomsjVu7aDPb9eacr8D A==; X-IronPort-AV: E=McAfee;i="6500,9779,10528"; a="292050354" X-IronPort-AV: E=Sophos;i="5.96,157,1665471600"; d="scan'208";a="292050354" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2022 10:35:59 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10528"; a="640089258" X-IronPort-AV: E=Sophos;i="5.96,157,1665471600"; d="scan'208";a="640089258" Received: from hermesli-mobl.amr.corp.intel.com (HELO kcaccard-desk.amr.corp.intel.com) ([10.212.218.5]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Nov 2022 10:35:58 -0800 From: Kristen Carlson Accardi <kristen@linux.intel.com> To: jarkko@kernel.org, dave.hansen@linux.kernel.org, tj@kernel.org, linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, cgroups@vger.kernel.org, Dave Hansen <dave.hansen@linux.intel.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com> Cc: zhiquan1.li@intel.com, Kristen Carlson Accardi <kristen@linux.intel.com>, Sean Christopherson <seanjc@google.com> Subject: [PATCH 10/26] x86/sgx: Return the number of EPC pages that were successfully reclaimed Date: Fri, 11 Nov 2022 10:35:15 -0800 Message-Id: <20221111183532.3676646-11-kristen@linux.intel.com> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20221111183532.3676646-1-kristen@linux.intel.com> References: <20221111183532.3676646-1-kristen@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749225942121497862?= X-GMAIL-MSGID: =?utf-8?q?1749225942121497862?= |
Series |
Add Cgroup support for SGX EPC memory
|
|
Commit Message
Kristen Carlson Accardi
Nov. 11, 2022, 6:35 p.m. UTC
From: Sean Christopherson <sean.j.christopherson@intel.com> Return the number of reclaimed pages from sgx_reclaim_pages(), the EPC cgroup will use the result to track the success rate of its reclaim calls, e.g. to escalate to a more forceful reclaiming mode if necessary. Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com> Signed-off-by: Kristen Carlson Accardi <kristen@linux.intel.com> Cc: Sean Christopherson <seanjc@google.com> --- arch/x86/kernel/cpu/sgx/main.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/cpu/sgx/main.c b/arch/x86/kernel/cpu/sgx/main.c index 02b9eafa90a2..dfd76c605ef2 100644 --- a/arch/x86/kernel/cpu/sgx/main.c +++ b/arch/x86/kernel/cpu/sgx/main.c @@ -291,7 +291,7 @@ static void sgx_reclaimer_write(struct sgx_epc_page *epc_page, * problematic as it would increase the lock contention too much, which would * halt forward progress. */ -static void __sgx_reclaim_pages(int nr_to_scan) +static int __sgx_reclaim_pages(int nr_to_scan) { struct sgx_backing backing[SGX_MAX_NR_TO_RECLAIM]; struct sgx_epc_page *epc_page, *tmp; @@ -326,7 +326,7 @@ static void __sgx_reclaim_pages(int nr_to_scan) spin_unlock(&sgx_global_lru.lock); if (list_empty(&iso)) - return; + return 0; i = 0; list_for_each_entry_safe(epc_page, tmp, &iso, list) { @@ -371,12 +371,16 @@ static void __sgx_reclaim_pages(int nr_to_scan) sgx_free_epc_page(epc_page); } + return i; } -static void sgx_reclaim_pages(int nr_to_scan) +static int sgx_reclaim_pages(int nr_to_scan) { - __sgx_reclaim_pages(nr_to_scan); + int ret; + + ret = __sgx_reclaim_pages(nr_to_scan); cond_resched(); + return ret; } static bool sgx_should_reclaim(unsigned long watermark)