Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1667814

Re: [PATCH] mm/list_lru.c: use cond_resched_lock() for nlru->lock

From Sahitya Tummala <stummala@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH] mm/list_lru.c: use cond_resched_lock() for nlru->lock
Date 2017-06-16 16:50 +0200
Message-ID <tT0Js-1ld-19@gated-at.bofh.it> (permalink)
References <tRlIl-3wc-1@gated-at.bofh.it> <tSKbE-7DA-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 6/16/2017 2:35 AM, Andrew Morton wrote:

> diff --git a/mm/list_lru.c b/mm/list_lru.c
>> index 5d8dffd..1af0709 100644
>> --- a/mm/list_lru.c
>> +++ b/mm/list_lru.c
>> @@ -249,6 +249,8 @@ restart:
>>   		default:
>>   			BUG();
>>   		}
>> +		if (cond_resched_lock(&nlru->lock))
>> +			goto restart;
>>   	}
>>   
>>   	spin_unlock(&nlru->lock);
> This is rather worrying.
>
> a) Why are we spending so long holding that lock that this is occurring?

At the time of crash I see that __list_lru_walk_one() shows number of
entries isolated as 1774475 with nr_items still pending as 130748. On my
system, I see that for dentries of 100000, it takes around 75ms for
__list_lru_walk_one() to complete. So for a total of 1900000 dentries as
in issue scenario, it will take upto 1425ms, which explains why the spin
lockup condition got hit on the other CPU.

It looks like __list_lru_walk_one() is expected to take more time if
there are more number of dentries present. And I think it is a valid
scenario to have those many number dentries.

> b) With this patch, we're restarting the entire scan.  Are there
>     situations in which this loop will never terminate, or will take a
>     very long time?  Suppose that this process is getting rescheds
>     blasted at it for some reason?

In the above scenario, I observed that the dentry entries from lru list
are removedall the time i.e LRU_REMOVED is returned from the
isolate (dentry_lru_isolate()) callback. I don't know if there is any case
where we skip several entries in the lru list and restartseveral times due
to this cond_resched_lock(). This can happen even with theexisting code
if LRU_RETRY is returned often from the isolate callback.
> IOW this looks like a bit of a band-aid and a deeper analysis and
> understanding might be needed.

-- 
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center, Inc.
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a Linux Foundation Collaborative Project.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH] mm/list_lru.c: use cond_resched_lock() for nlru->lock Sahitya Tummala <stummala@codeaurora.org> - 2017-06-12 02:50 +0200
  Re: [PATCH] mm/list_lru.c: use cond_resched_lock() for nlru->lock Jan Kara <jack@suse.cz> - 2017-06-12 15:20 +0200
  Re: [PATCH] mm/list_lru.c: use cond_resched_lock() for nlru->lock Andrew Morton <akpm@linux-foundation.org> - 2017-06-15 23:10 +0200
    Re: [PATCH] mm/list_lru.c: use cond_resched_lock() for nlru->lock Sahitya Tummala <stummala@codeaurora.org> - 2017-06-16 16:50 +0200
    Re: [PATCH] mm/list_lru.c: use cond_resched_lock() for nlru->lock Vladimir Davydov <vdavydov.dev@gmail.com> - 2017-06-17 13:20 +0200

csiph-web