lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 14 Mar 2017 16:13:33 -0700
From:   Tim Chen <tim.c.chen@...ux.intel.com>
To:     "Huang, Ying" <ying.huang@...el.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        Andrea Arcangeli <aarcange@...hat.com>,
        "Kirill A . Shutemov" <kirill.shutemov@...ux.intel.com>,
        Hugh Dickins <hughd@...gle.com>, Shaohua Li <shli@...nel.org>,
        Minchan Kim <minchan@...nel.org>,
        Rik van Riel <riel@...hat.com>
Subject: Re: [PATCH -mm -v6 3/9] mm, THP, swap: Add swap cluster
 allocate/free functions

On Wed, 2017-03-08 at 15:26 +0800, Huang, Ying wrote:
> From: Huang Ying <ying.huang@...el.com>
> 
> The swap cluster allocation/free functions are added based on the
> existing swap cluster management mechanism for SSD.  These functions
> don't work for the rotating hard disks because the existing swap cluster
> management mechanism doesn't work for them.  The hard disks support may
> be added if someone really need it.  But that needn't be included in
> this patchset.
> 
> This will be used for the THP (Transparent Huge Page) swap support.
> Where one swap cluster will hold the contents of each THP swapped out.
> 
> Cc: Andrea Arcangeli <aarcange@...hat.com>
> Cc: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
> Cc: Hugh Dickins <hughd@...gle.com>
> Cc: Shaohua Li <shli@...nel.org>
> Cc: Minchan Kim <minchan@...nel.org>
> Cc: Rik van Riel <riel@...hat.com>
> Signed-off-by: "Huang, Ying" <ying.huang@...el.com>
> ---
>  mm/swapfile.c | 217 +++++++++++++++++++++++++++++++++++++++++-----------------
>  1 file changed, 156 insertions(+), 61 deletions(-)
> 
> diff --git a/mm/swapfile.c b/mm/swapfile.c
> index a744604384ff..91876c33114b 100644
> --- a/mm/swapfile.c
> +++ b/mm/swapfile.c
> @@ -378,6 +378,14 @@ static void swap_cluster_schedule_discard(struct swap_info_struct *si,
>  	schedule_work(&si->discard_work);
>  }
>  
> +static void __free_cluster(struct swap_info_struct *si, unsigned long idx)
> +{
> +	struct swap_cluster_info *ci = si->cluster_info;
> +
> +	cluster_set_flag(ci + idx, CLUSTER_FLAG_FREE);
> +	cluster_list_add_tail(&si->free_clusters, ci, idx);
> +}
> +
>  /*
>   * Doing discard actually. After a cluster discard is finished, the cluster
>   * will be added to free cluster list. caller should hold si->lock.
> @@ -398,10 +406,7 @@ static void swap_do_scheduled_discard(struct swap_info_struct *si)
>  
>  		spin_lock(&si->lock);
>  		ci = lock_cluster(si, idx * SWAPFILE_CLUSTER);
> -		cluster_set_flag(ci, CLUSTER_FLAG_FREE);
> -		unlock_cluster(ci);
> -		cluster_list_add_tail(&si->free_clusters, info, idx);
> -		ci = lock_cluster(si, idx * SWAPFILE_CLUSTER);
> +		__free_cluster(si, idx);
>  		memset(si->swap_map + idx * SWAPFILE_CLUSTER,
>  				0, SWAPFILE_CLUSTER);
>  		unlock_cluster(ci);

The __free_cluster definition and the above change to eliminate
the extra unlock_cluster and lock_cluster can perhaps be broken up
as a separate patch.  It can be independent of THP changes.


Tim

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ