[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a31bdd1a-0fd8-7303-dc97-a2cf156f1d83@quicinc.com>
Date: Tue, 18 Jan 2022 17:05:40 +0530
From: Charan Teja Kalla <quic_charante@...cinc.com>
To: Matthew Wilcox <willy@...radead.org>
CC: Mark Hemment <markhemm@...glemail.com>, <hughd@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>, <vbabka@...e.cz>,
<rientjes@...gle.com>, <mhocko@...e.com>, <surenb@...gle.com>,
<shakeelb@...gle.com>, <linux-mm@...ck.org>,
<linux-kernel@...r.kernel.org>,
Charan Teja Reddy <charante@...eaurora.org>
Subject: Re: [PATCH v3 RESEND] mm: shmem: implement POSIX_FADV_[WILL|DONT]NEED
for shmem
Hello Matthew,
On 1/12/2022 7:05 PM, Charan Teja Kalla wrote:
>>>>> + rcu_read_lock();
>>>>> + xas_for_each(&xas, page, end) {
>>>>> + if (!xa_is_value(page))
>>>>> + continue;
>>>>> + xas_pause(&xas);
>>>>> + rcu_read_unlock();
>>>>> +
>>>>> + page = shmem_read_mapping_page(mapping, xas.xa_index);
>>>>> + if (!IS_ERR(page))
>>>>> + put_page(page);
>>>>> +
>>>>> + rcu_read_lock();
>>>>> + if (need_resched()) {
>>>>> + xas_pause(&xas);
>>>>> + cond_resched_rcu();
>>>>> + }
>>>>> + }
>>>>> + rcu_read_unlock();
>>> Even the xarray documentation says that: If most entries found during a
>>> walk require you to call xas_pause(), the xa_for_each() iterator may be
>>> more appropriate.
> Yes. This should obviously be an xa_for_each() loop.
In one of your patch[1], where we used xarray iterator, though most of
the entries found requires to call xas_pause() but still endup in using
xas_for_each() rather than xa_for_each(). Then, Should this code be
changed to use xa_for_each()? The documentation also says that "The
xas_for_each() iterator will expand into more inline code than
xa_for_each()."
[1]https://patchwork.kernel.org/project/linux-mm/patch/20200819184850.24779-4-willy@infradead.org/
Powered by blists - more mailing lists