From: Minchan Kim <minchan@kernel.org>
To: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@gmail.com>,
Jerome Marchand <jmarchan@redhat.com>,
juno.choi@lge.com, seungho1.park@lge.com,
Luigi Semenzato <semenzato@google.com>,
Nitin Gupta <ngupta@vflare.org>,
Seth Jennings <sjennings@variantweb.net>,
Dan Streetman <ddstreet@ieee.org>,
ds2horner@gmail.com
Subject: Re: [PATCH v5 3/4] zram: zram memory size limitation
Date: Tue, 26 Aug 2014 16:55:11 +0900 [thread overview]
Message-ID: <20140826075511.GI11319@bbox> (raw)
In-Reply-To: <20140826073730.GA1975@js1304-P5Q-DELUXE>
Hey Joonsoo,
On Tue, Aug 26, 2014 at 04:37:30PM +0900, Joonsoo Kim wrote:
> On Mon, Aug 25, 2014 at 09:05:55AM +0900, Minchan Kim wrote:
> > @@ -513,6 +540,14 @@ static int zram_bvec_write(struct zram *zram, struct bio_vec *bvec, u32 index,
> > ret = -ENOMEM;
> > goto out;
> > }
> > +
> > + if (zram->limit_pages &&
> > + zs_get_total_pages(meta->mem_pool) > zram->limit_pages) {
> > + zs_free(meta->mem_pool, handle);
> > + ret = -ENOMEM;
> > + goto out;
> > + }
> > +
> > cmem = zs_map_object(meta->mem_pool, handle, ZS_MM_WO);
>
> Hello,
>
> I don't follow up previous discussion, so I could be wrong.
> Why this enforcement should be here?
>
> I think that this has two problems.
> 1) alloc/free happens unnecessarilly if we have used memory over the
> limitation.
True but firstly, I implemented the logic in zsmalloc, not zram but
as I described in cover-letter, it's not a requirement of zsmalloc
but zram so it should be in there. If every user want it in future,
then we could move the function into zsmalloc. That's what we
concluded in previous discussion.
Another idea is we could call zs_get_total_pages right before zs_malloc
but the problem is we cannot know how many of pages are allocated
by zsmalloc in advance.
IOW, zram should be blind on zsmalloc's internal.
About alloc/free cost once if it is over the limit,
I don't think it's important to consider.
Do you have any scenario in your mind to consider alloc/free cost
when the limit is over?
> 2) Even if this request doesn't do new allocation, it could be failed
> due to other's allocation. There is time gap between allocation and
> free, so legimate user who want to use preallocated zsmalloc memory
> could also see this condition true and then he will be failed.
Yeb, we already discussed that. :)
Such false positive shouldn't be a severe problem if we can keep a
promise that zram user cannot exceed mem_limit.
>
> Thanks.
>
> --
> 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>
--
Kind regards,
Minchan Kim
--
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>
next prev parent reply other threads:[~2014-08-26 7:54 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-25 0:05 [PATCH v5 0/4] zram memory control enhance Minchan Kim
2014-08-25 0:05 ` [PATCH v5 1/4] zsmalloc: move pages_allocated to zs_pool Minchan Kim
2014-08-25 0:05 ` [PATCH v5 2/4] zsmalloc: change return value unit of zs_get_total_size_bytes Minchan Kim
2014-08-25 4:08 ` David Horner
2014-08-25 0:05 ` [PATCH v5 3/4] zram: zram memory size limitation Minchan Kim
2014-08-25 11:09 ` Sergey Senozhatsky
2014-08-26 4:52 ` Minchan Kim
2014-08-26 7:37 ` Joonsoo Kim
2014-08-26 7:55 ` Minchan Kim [this message]
2014-08-26 12:22 ` David Horner
2014-08-27 1:26 ` Joonsoo Kim
2014-08-27 2:51 ` Minchan Kim
2014-08-27 5:04 ` Joonsoo Kim
2014-08-27 7:28 ` Minchan Kim
2014-08-28 8:21 ` Joonsoo Kim
2014-08-27 14:03 ` Dan Streetman
2014-08-27 14:44 ` David Horner
2014-08-27 15:14 ` Dan Streetman
2014-08-27 15:35 ` David Horner
2014-08-27 16:29 ` Dan Streetman
2014-08-27 16:59 ` David Horner
2014-08-27 19:04 ` Dan Streetman
2014-08-28 3:04 ` Minchan Kim
2014-08-28 2:59 ` Minchan Kim
2014-08-28 2:52 ` Minchan Kim
2014-08-25 0:05 ` [PATCH v5 4/4] zram: report maximum used memory Minchan Kim
2014-08-25 4:05 ` David Horner
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=20140826075511.GI11319@bbox \
--to=minchan@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=ddstreet@ieee.org \
--cc=ds2horner@gmail.com \
--cc=iamjoonsoo.kim@lge.com \
--cc=jmarchan@redhat.com \
--cc=juno.choi@lge.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=ngupta@vflare.org \
--cc=semenzato@google.com \
--cc=sergey.senozhatsky@gmail.com \
--cc=seungho1.park@lge.com \
--cc=sjennings@variantweb.net \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).