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]
Message-ID: <4BF20872.8030200@vflare.org>
Date:	Tue, 18 May 2010 08:54:34 +0530
From:	Nitin Gupta <ngupta@...are.org>
To:	Minchan Kim <minchan.kim@...il.com>
CC:	Greg KH <greg@...ah.com>, Pekka Enberg <penberg@...helsinki.fi>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Nigel Cunningham <nigel@...onice.net>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Hugh Dickins <hugh.dickins@...cali.co.uk>,
	Cyp <cyp561@...il.com>, driverdev <devel@...verdev.osuosl.org>,
	linux-kernel <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 3/3] ramzswap: Handler for swap slot free callback

On 05/17/2010 05:33 PM, Minchan Kim wrote:
> On Mon, May 17, 2010 at 2:32 PM, Nitin Gupta <ngupta@...are.org> wrote:
>> Install handler for swap_slot_free_notify callback which is called
>> when a swap slot is no longer used. This handler immediately frees
>> memory allocated corresponding to the given swap slot.
>>
>> Signed-off-by: Nitin Gupta <ngupta@...are.org>
>> ---
>>  drivers/staging/ramzswap/TODO           |    5 -----
>>  drivers/staging/ramzswap/ramzswap_drv.c |   22 +++++++++++++---------
>>  2 files changed, 13 insertions(+), 14 deletions(-)
>>  delete mode 100644 drivers/staging/ramzswap/TODO
>>
>> diff --git a/drivers/staging/ramzswap/TODO b/drivers/staging/ramzswap/TODO
>> deleted file mode 100644
>> index 8d64e28..0000000
>> --- a/drivers/staging/ramzswap/TODO
>> +++ /dev/null
>> @@ -1,5 +0,0 @@
>> -TODO:
>> -       - Add support for swap notifiers
>> -
>> -Please send patches to Greg Kroah-Hartman <greg@...ah.com> and
>> -Nitin Gupta <ngupta@...are.org>
>> diff --git a/drivers/staging/ramzswap/ramzswap_drv.c b/drivers/staging/ramzswap/ramzswap_drv.c
>> index ee5eb12..ab15276 100644
>> --- a/drivers/staging/ramzswap/ramzswap_drv.c
>> +++ b/drivers/staging/ramzswap/ramzswap_drv.c
>> @@ -795,14 +795,6 @@ static int ramzswap_write(struct ramzswap *rzs, struct bio *bio)
>>
>>        src = rzs->compress_buffer;
>>
>> -       /*
>> -        * System swaps to same sector again when the stored page
>> -        * is no longer referenced by any process. So, its now safe
>> -        * to free the memory that was allocated for this page.
>> -        */
>> -       if (rzs->table[index].page || rzs_test_flag(rzs, index, RZS_ZERO))
>> -               ramzswap_free_page(rzs, index);
>> -
>>        mutex_lock(&rzs->lock);
>>
>>        user_mem = kmap_atomic(page, KM_USER0);
>> @@ -1295,9 +1287,21 @@ out:
>>        return ret;
>>  }
>>
>> +void ramzswap_slot_free_notify(struct block_device *bdev, unsigned long index)
>> +{
>> +       struct ramzswap *rzs;
>> +
>> +       rzs = bdev->bd_disk->private_data;
>> +       ramzswap_free_page(rzs, index);
>> +       rzs_stat64_inc(rzs, &rzs->stats.notify_free);
>> +
>> +       return;
>> +}
> 
> Mistake. Let's remove _return_ in void function.
> Otherwise, looks good to me.
> 

I will do this in upcoming cleanup patches.

Thanks for the review.
Nitin


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ