Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1400533
| From | Minchan Kim <minchan@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] zram: introduce per-device debug_stat sysfs node |
| Date | 2016-05-13 08:30 +0200 |
| Message-ID | <ryeLR-66n-9@gated-at.bofh.it> (permalink) |
| References | <rxBKs-8nL-41@gated-at.bofh.it> <ry8wH-81C-11@gated-at.bofh.it> <ry9M5-XI-7@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Fri, May 13, 2016 at 10:09:29AM +0900, Sergey Senozhatsky wrote:
> Hello Minchan,
>
> On (05/13/16 08:41), Minchan Kim wrote:
> [..]
>
> will fix and update, thanks!
>
>
> > > @@ -719,6 +737,8 @@ compress_again:
> > > zcomp_strm_release(zram->comp, zstrm);
> > > zstrm = NULL;
> > >
> > > + atomic64_inc(&zram->stats.num_recompress);
> > > +
> >
> > It should be below "goto compress_again".
>
> I moved it out of goto intentionally. this second zs_malloc()
>
> handle = zs_malloc(meta->mem_pool, clen,
> GFP_NOIO | __GFP_HIGHMEM |
> __GFP_MOVABLE);
>
> can take some time to complete, which will slow down zram for a bit,
> and _theoretically_ this second zs_malloc() still can fail. yes, we
> would do the error print out pr_err("Error allocating memory ... ")
> and inc the `failed_writes' in zram_bvec_rw(), but zram_bvec_write()
> has several more error return paths that can inc the `failed_writes'.
> so by just looking at the stats we won't be able to tell that we had
> failed fast path allocation combined with failed slow path allocation
> (IOW, `goto recompress' never happened).
>
> so I'm thinking about changing its name to num_failed_fast_compress
> or num_failed_fast_write, or something similar and thus count the number
> of times we fell to "!handle" branch, not the number of goto-s.
> what do you think? or do you want it to be num_recompress specifically?
Sorry, I don't get your point.
What's the problem with below?
goto compress_again
so
atomic_inc(num_recompress)
My concern isn't a performance or something but just want to be more
readable and not error-prone which can increase num_compress although
second zs_malloc could be failed. When I tested with heavy workload,
I saw second zs_malloc can be fail but not frequently so it's not
theoretical issue.
What's the your concern with below?
Sorry if I don't get your point. Please elaborate it more.
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c
index a629bd8d452b..8bdcc4b2b9b8 100644
--- a/drivers/block/zram/zram_drv.c
+++ b/drivers/block/zram/zram_drv.c
@@ -737,12 +737,12 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
zcomp_strm_release(zram->comp, zstrm);
zstrm = NULL;
- atomic64_inc(&zram->stats.num_recompress);
-
handle = zs_malloc(meta->mem_pool, clen,
GFP_NOIO | __GFP_HIGHMEM);
- if (handle)
+ if (handle) {
+ atomic64_inc(&zram->stats.num_recompress);
goto compress_again;
+ }
pr_err("Error allocating memory for compressed page: %u, size=%zu\n",
index, clen);
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [PATCH] zram: introduce per-device debug_stat sysfs node Minchan Kim <minchan@kernel.org> - 2016-05-13 01:50 +0200
Re: [PATCH] zram: introduce per-device debug_stat sysfs node Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-05-13 03:10 +0200
Re: [PATCH] zram: introduce per-device debug_stat sysfs node Minchan Kim <minchan@kernel.org> - 2016-05-13 08:30 +0200
Re: [PATCH] zram: introduce per-device debug_stat sysfs node Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-05-13 09:00 +0200
Re: [PATCH] zram: introduce per-device debug_stat sysfs node Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-05-13 09:10 +0200
Re: [PATCH] zram: introduce per-device debug_stat sysfs node Minchan Kim <minchan@kernel.org> - 2016-05-13 09:20 +0200
Re: [PATCH] zram: introduce per-device debug_stat sysfs node Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-05-13 09:40 +0200
Re: [PATCH] zram: introduce per-device debug_stat sysfs node Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-05-13 10:10 +0200
Re: [PATCH] zram: introduce per-device debug_stat sysfs node Minchan Kim <minchan@kernel.org> - 2016-05-14 01:10 +0200
Re: [PATCH] zram: introduce per-device debug_stat sysfs node Sergey Senozhatsky <sergey.senozhatsky@gmail.com> - 2016-05-14 04:40 +0200
csiph-web