Re: [PATCH v5 0/9] mm: swap: mTHP swap allocator base on swap cluster order

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Kairui Song <ryncsn@xxxxxxxxx> writes:

[snip]

> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -450,7 +450,10 @@ static void __free_cluster(struct swap_info_struct *si, struct swap_cluster_info
>  	lockdep_assert_held(&si->lock);
>  	lockdep_assert_held(&ci->lock);
>  
> -	list_move_tail(&ci->list, &si->free_clusters);
> +	if (ci->flags)
> +		list_move_tail(&ci->list, &si->free_clusters);
> +	else
> +		list_add_tail(&ci->list, &si->free_clusters);

If we use list_del_init() to delete the cluster, we can always use
list_move_tail()?  If so, the logic can be simplified.

>  	ci->flags = CLUSTER_FLAG_FREE;
>  	ci->order = 0;
>  }
> @@ -474,7 +477,6 @@ static void swap_do_scheduled_discard(struct swap_info_struct *si)
>  				SWAPFILE_CLUSTER);
>  
>  		spin_lock(&si->lock);
> -
>  		spin_lock(&ci->lock);
>  		__free_cluster(si, ci);
>  		memset(si->swap_map + idx * SWAPFILE_CLUSTER,
> @@ -666,7 +668,7 @@ static void cluster_alloc_range(struct swap_info_struct *si, struct swap_cluster
>  		if (ci->flags & CLUSTER_FLAG_FRAG)
>  			si->frag_cluster_nr[ci->order]--;
>  		list_move_tail(&ci->list, &si->full_clusters);
> -		ci->flags = 0;
> +		ci->flags = CLUSTER_FLAG_FULL;
>  	}
>  }

--
Best Regards,
Huang, Ying




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux