Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1492346
| From | "Huang\, Ying" <ying.huang@intel.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 2/8] mm/swap: Add cluster lock |
| Date | 2016-09-28 11:00 +0200 |
| Message-ID | <smiSC-4tf-11@gated-at.bofh.it> (permalink) |
| References | <sm4cW-3RC-29@gated-at.bofh.it> <smiIW-4q0-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 2/8] mm/swap: Add cluster lock Tim Chen <tim.c.chen@linux.intel.com> - 2016-09-27 19:20 +0200
Re: [PATCH 2/8] mm/swap: Add cluster lock "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2016-09-28 10:50 +0200
Re: [PATCH 2/8] mm/swap: Add cluster lock "Huang\, Ying" <ying.huang@intel.com> - 2016-09-28 11:00 +0200
csiph-web