OpenVZ Forum


Home » Mailing lists » Devel » Re: [Fwd: [PATCH -RSS 2/2] Fix limit check after reclaim]
Re: Re: [Fwd: [PATCH -RSS 2/2] Fix limit check after reclaim] [message #18754 is a reply to message #18749] Tue, 05 June 2007 07:10 Go to previous messageGo to previous message
Balbir Singh is currently offline  Balbir Singh
Messages: 491
Registered: August 2006
Senior Member
Pavel Emelianov wrote:
> Balbir Singh wrote:
>> Pavel Emelianov wrote:
>>>> +static inline bool res_counter_check_under_limit(struct res_counter *cnt)
>>>> +{
>>>> +	bool ret;
>>>> +	unsigned long flags;
>>>> +
>>>> +	spin_lock_irqsave(&cnt->lock, flags);
>>>> +	ret = res_counter_limit_check_locked(cnt);
>>> We don't have to take the lock for such a check.
>>>
>>  
>> This check without the lock could be racy and return incorrect
>> results -- leading to OOM.
> 
> Maybe. Nevertheless, if we do not trust the return value of
> try_to_free_pages() then the code should probably look like
> 
> while (1) {
> 	if (res_counter_charge() == 0)
> 		break;
> 
> 	did_progress = try_to_free_pages();
> 	if (res_counter_charge() == 0)
> 		break;
> 
> 	if (!did_progress)
> 		out_of_memory();
> }
> 

Yes, this looks better.

> But in any case we must know for sure was at least one page
> freed or not...
> 
> Thanks,
> Pavel


-- 
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL
_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: [PATCH ext3/ext4] orphan list check on destroy_inode
Next Topic: [RFC PATCH ext3/ext4] orphan list corruption due bad inode
Goto Forum:
  


Current Time: Mon Sep 08 19:25:35 GMT 2025

Total time taken to generate the page: 0.06720 seconds