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] [day] [month] [year] [list]
Message-ID: <acebe1de-1281-cfd2-8497-b7d52a26e8ec@huawei.com>
Date: Tue, 2 Jul 2024 16:00:16 +0800
From: xiujianfeng <xiujianfeng@...wei.com>
To: Kamalesh Babulal <kamalesh.babulal@...cle.com>, <tj@...nel.org>,
	<lizefan.x@...edance.com>, <hannes@...xchg.org>, <corbet@....net>,
	<haitao.huang@...ux.intel.com>
CC: <cgroups@...r.kernel.org>, <linux-doc@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v3 -next] cgroup/misc: Introduce misc.peak



On 2024/7/2 15:24, Kamalesh Babulal wrote:
> Hi,
> 
> On 7/2/24 6:18 AM, Xiu Jianfeng wrote:
> [...]
> 
>> diff --git a/kernel/cgroup/misc.c b/kernel/cgroup/misc.c
>> index 79a3717a5803..7f5180a8f461 100644
>> --- a/kernel/cgroup/misc.c
>> +++ b/kernel/cgroup/misc.c
>> @@ -121,6 +121,17 @@ static void misc_cg_cancel_charge(enum misc_res_type type, struct misc_cg *cg,
>>  		  misc_res_name[type]);
>>  }
>>  
>> +static void misc_cg_update_watermark(struct misc_res *res, u64 new_usage)
>> +{
>> +	u64 old;
>> +
>> +	do {
>> +		old = READ_ONCE(res->watermark);
>> +		if (cmpxchg(&res->watermark, old, new_usage) == old)
>> +			break;
>> +	} while (1);
>> +}
>> +
>>  /**
>>   * misc_cg_try_charge() - Try charging the misc cgroup.
>>   * @type: Misc res type to charge.
>> @@ -159,6 +170,7 @@ int misc_cg_try_charge(enum misc_res_type type, struct misc_cg *cg, u64 amount)
>>  			ret = -EBUSY;
>>  			goto err_charge;
>>  		}
> 
> you may need to re-introduce the check:
> 	if (new_usage > READ_ONCE(res->watermark))
> 
> without it, the res->watermark will be updated unconditionally.

Thanks for your review, will fix it.

> 
>> +		misc_cg_update_watermark(res, new_usage);
>>  	}
>>  	return 0;
>>  
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ