lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 16 Feb 2024 00:07:28 -0600
From: "Haitao Huang" <haitao.huang@...ux.intel.com>
To: jarkko@...nel.org, dave.hansen@...ux.intel.com, tj@...nel.org,
 mkoutny@...e.com, linux-kernel@...r.kernel.org, linux-sgx@...r.kernel.org,
 x86@...nel.org, cgroups@...r.kernel.org, tglx@...utronix.de, mingo@...hat.com,
 bp@...en8.de, hpa@...or.com, sohil.mehta@...el.com,
 tim.c.chen@...ux.intel.com, "Dave Hansen" <dave.hansen@...el.com>
Cc: zhiquan1.li@...el.com, kristen@...ux.intel.com, seanjc@...gle.com,
 zhanb@...rosoft.com, anakrish@...rosoft.com, mikko.ylinen@...ux.intel.com,
 yangjie@...rosoft.com, chrisyan@...rosoft.com
Subject: Re: [PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup
 reclamation

Hi Dave,

On Thu, 15 Feb 2024 17:43:18 -0600, Dave Hansen <dave.hansen@...el.com>  
wrote:

> On 2/5/24 13:06, Haitao Huang wrote:
>>  static struct mem_cgroup *sgx_encl_get_mem_cgroup(struct sgx_encl  
>> *encl)
>>  {
>> @@ -1003,14 +1001,6 @@ static struct mem_cgroup  
>> *sgx_encl_get_mem_cgroup(struct sgx_encl *encl)
>>  	struct sgx_encl_mm *encl_mm;
>>  	int idx;
>>
>> -	/*
>> -	 * If called from normal task context, return the mem_cgroup
>> -	 * of the current task's mm. The remainder of the handling is for
>> -	 * ksgxd.
>> -	 */
>> -	if (!current_is_ksgxd())
>> -		return get_mem_cgroup_from_mm(current->mm);
>
> Why is this being removed?
>
> Searching the enclave mm list is a last resort.  It's expensive and
> imprecise.
>
> get_mem_cgroup_from_mm(current->mm), on the other hand is fast and  
> precise.
>

I introduced a boolean flag to indicate caller is in kthread (ksgxd or  
cgroup workqueue), so sgx_encl_alloc_backing only calls this function if  
that flag is true, meaning search through the mm_list is needed.

But now I think a more straightforward way is to just replace  
current_is_ksgxd() with (current->flags & PF_KTHREAD).

Thanks

Haitao

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ