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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170516013022.GB10262@jagdpanzerIV.localdomain>
Date:   Tue, 16 May 2017 10:30:22 +0900
From:   Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>
To:     Minchan Kim <minchan@...nel.org>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        linux-kernel@...r.kernel.org, Joonsoo Kim <iamjoonsoo.kim@....com>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        kernel-team <kernel-team@....com>
Subject: Re: [PATCH 2/2] zram: do not count duplicated pages as compressed

On (05/15/17 16:41), Minchan Kim wrote:
[..]
> diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
> index b885356551e9..8152e405117b 100644
> --- a/drivers/block/zram/zram_drv.c
> +++ b/drivers/block/zram/zram_drv.c
> @@ -624,15 +624,22 @@ static void zram_free_page(struct zram *zram, size_t index)
>  		return;
>  	}
>  
> +	if (zram_dedup_enabled(zram) &&
> +			zram_test_flag(zram, index, ZRAM_DUP)) {
> +		zram_clear_flag(zram, index, ZRAM_DUP);
> +		atomic64_sub(entry->len, &zram->stats.dup_data_size);
> +		goto out;
> +	}

so that `goto' there is to just jump over ->stats.compr_data_size?
can you sub ->stats.compr_data_size before the `if' and avoid labels?

>  	if (!entry)
>  		return;

shouldn't this `if' be moved before `if (zram_dedup_enabled(zram)`?


[..]
> @@ -794,7 +801,15 @@ static int __zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index)
>  	entry = zram_dedup_find(zram, page, &checksum);
>  	if (entry) {
>  		comp_len = entry->len;
> -		goto found_dup;
> +		zram_slot_lock(zram, index);
> +		zram_free_page(zram, index);
> +		zram_set_flag(zram, index, ZRAM_DUP);
> +		zram_set_entry(zram, index, entry);
> +		zram_set_obj_size(zram, index, comp_len);
> +		zram_slot_unlock(zram, index);
> +		atomic64_add(comp_len, &zram->stats.dup_data_size);
> +		atomic64_inc(&zram->stats.pages_stored);
> +		return 0;

hm. that's a somewhat big code duplication. isn't it?

	-ss

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ