From: "Huang\, Ying" <ying.huang@intel.com>
To: Hillf Danton <hillf.zj@alibaba-inc.com>
Cc: tim.c.chen@linux.intel.com,
'Andrew Morton' <akpm@linux-foundation.org>,
dave.hansen@intel.com, andi.kleen@intel.com, aaron.lu@intel.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
'Huang Ying' <ying.huang@intel.com>,
'Hugh Dickins' <hughd@google.com>, 'Shaohua Li' <shli@kernel.org>,
'Minchan Kim' <minchan@kernel.org>,
'Rik van Riel' <riel@redhat.com>,
'Andrea Arcangeli' <aarcange@redhat.com>,
"'Kirill A . Shutemov'" <kirill.shutemov@linux.intel.com>,
'Vladimir Davydov' <vdavydov@virtuozzo.com>,
'Johannes Weiner' <hannes@cmpxchg.org>,
'Michal Hocko' <mhocko@kernel.org>
Subject: Re: [PATCH 2/8] mm/swap: Add cluster lock
Date: Wed, 28 Sep 2016 16:51:18 +0800 [thread overview]
Message-ID: <87mvispfuh.fsf@yhuang-dev.intel.com> (raw)
In-Reply-To: <004101d21964$3b3d68f0$b1b83ad0$@alibaba-inc.com> (Hillf Danton's message of "Wed, 28 Sep 2016 16:42:21 +0800")
Hillf Danton <hillf.zj@alibaba-inc.com> writes:
> On Wednesday, September 28, 2016 1:18 AM Tim Chen wrote
>>
>> @@ -447,8 +505,9 @@ static void scan_swap_map_try_ssd_cluster(struct swap_info_struct *si,
>> unsigned long *offset, unsigned long *scan_base)
>> {
>> struct percpu_cluster *cluster;
>> + struct swap_cluster_info *ci;
>> bool found_free;
>> - unsigned long tmp;
>> + unsigned long tmp, max;
>>
>> new_cluster:
>> cluster = this_cpu_ptr(si->percpu_cluster);
>> @@ -476,14 +535,21 @@ new_cluster:
>> * check if there is still free entry in the cluster
>> */
>> tmp = cluster->next;
>> - while (tmp < si->max && tmp < (cluster_next(&cluster->index) + 1) *
>> - SWAPFILE_CLUSTER) {
>
> Currently tmp is checked to be less than both values.
>
>> + max = max_t(unsigned long, si->max,
>> + (cluster_next(&cluster->index) + 1) * SWAPFILE_CLUSTER);
>> + if (tmp >= max) {
>> + cluster_set_null(&cluster->index);
>> + goto new_cluster;
>> + }
>> + ci = lock_cluster(si, tmp);
>> + while (tmp < max) {
>
> In this work tmp is checked to be less than the max value.
> Semantic change hoped?
Oops! tmp should be checked to be more than the min value. Will fix it
in the next version. Thanks for pointing out this!
Best Regards,
Huang, Ying
>> if (!si->swap_map[tmp]) {
>> found_free = true;
>> break;
>> }
>> tmp++;
>> }
>> + unlock_cluster(ci);
>> if (!found_free) {
>> cluster_set_null(&cluster->index);
>> goto new_cluster;
>>
> thanks
> Hillf
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
prev parent reply other threads:[~2016-09-28 8:51 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-27 17:18 Tim Chen
2016-09-28 8:42 ` Hillf Danton
2016-09-28 8:51 ` Huang, Ying [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=87mvispfuh.fsf@yhuang-dev.intel.com \
--to=ying.huang@intel.com \
--cc=aarcange@redhat.com \
--cc=aaron.lu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=andi.kleen@intel.com \
--cc=dave.hansen@intel.com \
--cc=hannes@cmpxchg.org \
--cc=hillf.zj@alibaba-inc.com \
--cc=hughd@google.com \
--cc=kirill.shutemov@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@kernel.org \
--cc=minchan@kernel.org \
--cc=riel@redhat.com \
--cc=shli@kernel.org \
--cc=tim.c.chen@linux.intel.com \
--cc=vdavydov@virtuozzo.com \
/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