From: Minchan Kim <minchan@kernel.org>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH] zram: introduce per-device debug_stat sysfs node
Date: Fri, 13 May 2016 15:23:03 +0900 [thread overview]
Message-ID: <20160513062303.GA21204@bbox> (raw)
In-Reply-To: <20160513010929.GA615@swordfish>
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);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
WARNING: multiple messages have this Message-ID (diff)
From: Minchan Kim <minchan@kernel.org>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
<linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>
Subject: Re: [PATCH] zram: introduce per-device debug_stat sysfs node
Date: Fri, 13 May 2016 15:23:03 +0900 [thread overview]
Message-ID: <20160513062303.GA21204@bbox> (raw)
In-Reply-To: <20160513010929.GA615@swordfish>
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);
next prev parent reply other threads:[~2016-05-13 6:22 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-11 13:45 [PATCH] zram: introduce per-device debug_stat sysfs node Sergey Senozhatsky
2016-05-11 13:45 ` Sergey Senozhatsky
2016-05-12 23:41 ` Minchan Kim
2016-05-12 23:41 ` Minchan Kim
2016-05-13 1:09 ` Sergey Senozhatsky
2016-05-13 1:09 ` Sergey Senozhatsky
2016-05-13 6:23 ` Minchan Kim [this message]
2016-05-13 6:23 ` Minchan Kim
2016-05-13 6:58 ` Sergey Senozhatsky
2016-05-13 6:58 ` Sergey Senozhatsky
2016-05-13 7:05 ` Sergey Senozhatsky
2016-05-13 7:05 ` Sergey Senozhatsky
2016-05-13 7:20 ` Minchan Kim
2016-05-13 7:20 ` Minchan Kim
2016-05-13 7:41 ` Sergey Senozhatsky
2016-05-13 7:41 ` Sergey Senozhatsky
2016-05-13 8:06 ` Sergey Senozhatsky
2016-05-13 8:06 ` Sergey Senozhatsky
2016-05-13 23:05 ` Minchan Kim
2016-05-13 23:05 ` Minchan Kim
2016-05-14 3:37 ` Sergey Senozhatsky
2016-05-14 3:37 ` Sergey Senozhatsky
-- strict thread matches above, loose matches on Subject: below --
2016-05-13 13:03 Sergey Senozhatsky
2016-05-13 23:08 ` Minchan Kim
2016-05-14 3:38 ` Sergey Senozhatsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160513062303.GA21204@bbox \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=sergey.senozhatsky.work@gmail.com \
--cc=sergey.senozhatsky@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.