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] [day] [month] [year] [list]
Date:   Thu, 29 Sep 2016 09:50:36 -0700
From:   Tim Chen <tim.c.chen@...ux.intel.com>
To:     Hillf Danton <hillf.zj@...baba-inc.com>,
        'Andrew Morton' <akpm@...ux-foundation.org>
Cc:     dave.hansen@...el.com, andi.kleen@...el.com, aaron.lu@...el.com,
        linux-mm@...ck.org, linux-kernel@...r.kernel.org,
        'Huang Ying' <ying.huang@...el.com>,
        'Hugh Dickins' <hughd@...gle.com>,
        'Shaohua Li' <shli@...nel.org>,
        'Minchan Kim' <minchan@...nel.org>,
        'Rik van Riel' <riel@...hat.com>,
        'Andrea Arcangeli' <aarcange@...hat.com>,
        "'Kirill A . Shutemov'" <kirill.shutemov@...ux.intel.com>,
        'Vladimir Davydov' <vdavydov@...tuozzo.com>,
        'Johannes Weiner' <hannes@...xchg.org>,
        'Michal Hocko' <mhocko@...nel.org>
Subject: Re: [PATCH 7/8] mm/swap: Add cache for swap slots allocation

On Thu, 2016-09-29 at 15:04 +0800, Hillf Danton wrote:
> On Wednesday, September 28, 2016 1:19 AM Tim Chen wrote
> [...]
> > 
> > +
> > +static int alloc_swap_slot_cache(int cpu)
> > +{
> > +	struct swap_slots_cache *cache;
> > +
> > +	cache = &per_cpu(swp_slots, cpu);
> > +	mutex_init(&cache->alloc_lock);
> > +	spin_lock_init(&cache->free_lock);
> > +	cache->nr = 0;
> > +	cache->cur = 0;
> > +	cache->n_ret = 0;
> > +	cache->slots = vzalloc(sizeof(swp_entry_t) * SWAP_SLOTS_CACHE_SIZE);
> > +	if (!cache->slots) {
> > +		swap_slot_cache_enabled = false;
> > +		return -ENOMEM;
> > +	}
> > +	cache->slots_ret = vzalloc(sizeof(swp_entry_t) * SWAP_SLOTS_CACHE_SIZE);
> > +	if (!cache->slots_ret) {
> > +		vfree(cache->slots);
> > +		swap_slot_cache_enabled = false;
> > +		return -ENOMEM;
> > +	}
> > +	return 0;
> > +}
> > +
> [...]
> > 
> > +
> > +static void free_slot_cache(int cpu)
> > +{
> > +	struct swap_slots_cache *cache;
> > +
> > +	mutex_lock(&swap_slots_cache_mutex);
> > +	drain_slots_cache_cpu(cpu, SLOTS_CACHE | SLOTS_CACHE_RET);
> > +	cache = &per_cpu(swp_slots, cpu);
> > +	cache->nr = 0;
> > +	cache->cur = 0;
> > +	cache->n_ret = 0;
> > +	vfree(cache->slots);
> Also free cache->slots_ret?

Good point.  Should free cache->slots_ret here.

Tim

> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ