Linux Documentation
 help / color / mirror / Atom feed
From: xiujianfeng <xiujianfeng@huawei.com>
To: Kamalesh Babulal <kamalesh.babulal@oracle.com>, <tj@kernel.org>,
	<lizefan.x@bytedance.com>, <hannes@cmpxchg.org>, <corbet@lwn.net>,
	<haitao.huang@linux.intel.com>
Cc: <cgroups@vger.kernel.org>, <linux-doc@vger.kernel.org>,
	<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v3 -next] cgroup/misc: Introduce misc.peak
Date: Tue, 2 Jul 2024 16:00:16 +0800	[thread overview]
Message-ID: <acebe1de-1281-cfd2-8497-b7d52a26e8ec@huawei.com> (raw)
In-Reply-To: <8bd9b2a6-e1c2-423c-9cea-45b14763e251@oracle.com>



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;
>>  
> 
> 

      reply	other threads:[~2024-07-02  8:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-02  0:48 [PATCH v3 -next] cgroup/misc: Introduce misc.peak Xiu Jianfeng
2024-07-02  7:24 ` Kamalesh Babulal
2024-07-02  8:00   ` xiujianfeng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=acebe1de-1281-cfd2-8497-b7d52a26e8ec@huawei.com \
    --to=xiujianfeng@huawei.com \
    --cc=cgroups@vger.kernel.org \
    --cc=corbet@lwn.net \
    --cc=haitao.huang@linux.intel.com \
    --cc=hannes@cmpxchg.org \
    --cc=kamalesh.babulal@oracle.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan.x@bytedance.com \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox