Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1380880 > unrolled thread
| Started by | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> |
|---|---|
| First post | 2016-04-18 03:10 +0200 |
| Last post | 2016-04-19 10:00 +0200 |
| Articles | 3 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH v3 11/16] zsmalloc: separate free_zspage from putback_zspage Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-04-18 03:10 +0200
Re: [PATCH v3 11/16] zsmalloc: separate free_zspage from putback_zspage Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> - 2016-04-19 10:00 +0200
Re: [PATCH v3 11/16] zsmalloc: separate free_zspage from putback_zspage Minchan Kim <minchan@kernel.org> - 2016-04-19 10:00 +0200
| From | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> |
|---|---|
| Date | 2016-04-18 03:10 +0200 |
| Subject | Re: [PATCH v3 11/16] zsmalloc: separate free_zspage from putback_zspage |
| Message-ID | <rp5Rn-55Q-5@gated-at.bofh.it> |
Hello Minchan,
On (03/30/16 16:12), Minchan Kim wrote:
[..]
> @@ -1835,23 +1827,31 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class)
> if (!migrate_zspage(pool, class, &cc))
> break;
>
> - putback_zspage(pool, class, dst_page);
> + VM_BUG_ON_PAGE(putback_zspage(pool, class,
> + dst_page) == ZS_EMPTY, dst_page);
can this VM_BUG_ON_PAGE() condition ever be true?
> }
> /* Stop if we couldn't find slot */
> if (dst_page == NULL)
> break;
> - putback_zspage(pool, class, dst_page);
> - if (putback_zspage(pool, class, src_page) == ZS_EMPTY)
> + VM_BUG_ON_PAGE(putback_zspage(pool, class,
> + dst_page) == ZS_EMPTY, dst_page);
hm... this VM_BUG_ON_PAGE(dst_page) is sort of confusing. under what
circumstances it can be true?
a minor nit, it took me some time (need some coffee I guess) to
correctly parse this macro wrapper
VM_BUG_ON_PAGE(putback_zspage(pool, class,
dst_page) == ZS_EMPTY, dst_page);
may be do it like:
fullness = putback_zspage(pool, class, dst_page);
VM_BUG_ON_PAGE(fullness == ZS_EMPTY, dst_page);
well, if we want to VM_BUG_ON_PAGE() at all. there haven't been any
problems with compaction, is there any specific reason these macros
were added?
> + if (putback_zspage(pool, class, src_page) == ZS_EMPTY) {
> pool->stats.pages_compacted += class->pages_per_zspage;
> - spin_unlock(&class->lock);
> + spin_unlock(&class->lock);
> + free_zspage(pool, class, src_page);
do we really need to free_zspage() out of class->lock?
wouldn't something like this
if (putback_zspage(pool, class, src_page) == ZS_EMPTY) {
pool->stats.pages_compacted += class->pages_per_zspage;
free_zspage(pool, class, src_page);
}
spin_unlock(&class->lock);
be simpler?
besides, free_zspage() now updates class stats out of class lock,
not critical but still.
-ss
> + } else {
> + spin_unlock(&class->lock);
> + }
> +
> cond_resched();
> spin_lock(&class->lock);
> }
>
> if (src_page)
> - putback_zspage(pool, class, src_page);
> + VM_BUG_ON_PAGE(putback_zspage(pool, class,
> + src_page) == ZS_EMPTY, src_page);
>
> spin_unlock(&class->lock);
> }
[toc] | [next] | [standalone]
| From | Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com> |
|---|---|
| Date | 2016-04-19 10:00 +0200 |
| Message-ID | <rpyJI-3gW-1@gated-at.bofh.it> |
| In reply to | #1380880 |
Hello Minchan, On (04/19/16 16:51), Minchan Kim wrote: [..] > > I guess it is remained thing after I rebased to catch any mistake. > But I'm heavily chainging this part. > Please review next version instead of this after a few days. :) ah, got it. thanks! -ss
[toc] | [prev] | [next] | [standalone]
| From | Minchan Kim <minchan@kernel.org> |
|---|---|
| Date | 2016-04-19 10:00 +0200 |
| Message-ID | <rpyJI-3gW-3@gated-at.bofh.it> |
| In reply to | #1380880 |
Hi Sergey,
On Mon, Apr 18, 2016 at 10:04:08AM +0900, Sergey Senozhatsky wrote:
> Hello Minchan,
>
> On (03/30/16 16:12), Minchan Kim wrote:
> [..]
> > @@ -1835,23 +1827,31 @@ static void __zs_compact(struct zs_pool *pool, struct size_class *class)
> > if (!migrate_zspage(pool, class, &cc))
> > break;
> >
> > - putback_zspage(pool, class, dst_page);
> > + VM_BUG_ON_PAGE(putback_zspage(pool, class,
> > + dst_page) == ZS_EMPTY, dst_page);
>
> can this VM_BUG_ON_PAGE() condition ever be true?
I guess it is remained thing after I rebased to catch any mistake.
But I'm heavily chainging this part.
Please review next version instead of this after a few days. :)
>
> > }
> > /* Stop if we couldn't find slot */
> > if (dst_page == NULL)
> > break;
> > - putback_zspage(pool, class, dst_page);
> > - if (putback_zspage(pool, class, src_page) == ZS_EMPTY)
> > + VM_BUG_ON_PAGE(putback_zspage(pool, class,
> > + dst_page) == ZS_EMPTY, dst_page);
>
> hm... this VM_BUG_ON_PAGE(dst_page) is sort of confusing. under what
> circumstances it can be true?
>
> a minor nit, it took me some time (need some coffee I guess) to
> correctly parse this macro wrapper
>
> VM_BUG_ON_PAGE(putback_zspage(pool, class,
> dst_page) == ZS_EMPTY, dst_page);
>
> may be do it like:
> fullness = putback_zspage(pool, class, dst_page);
> VM_BUG_ON_PAGE(fullness == ZS_EMPTY, dst_page);
>
>
> well, if we want to VM_BUG_ON_PAGE() at all. there haven't been any
> problems with compaction, is there any specific reason these macros
> were added?
>
>
>
> > + if (putback_zspage(pool, class, src_page) == ZS_EMPTY) {
> > pool->stats.pages_compacted += class->pages_per_zspage;
> > - spin_unlock(&class->lock);
> > + spin_unlock(&class->lock);
> > + free_zspage(pool, class, src_page);
>
> do we really need to free_zspage() out of class->lock?
> wouldn't something like this
>
> if (putback_zspage(pool, class, src_page) == ZS_EMPTY) {
> pool->stats.pages_compacted += class->pages_per_zspage;
> free_zspage(pool, class, src_page);
> }
> spin_unlock(&class->lock);
>
> be simpler?
The reason I did out of class->lock is deadlock between page_lock
and class->lock with upcoming page migration.
However, as I said, I'm now heavily changing the part. :)
>
> besides, free_zspage() now updates class stats out of class lock,
> not critical but still.
>
> -ss
>
> > + } else {
> > + spin_unlock(&class->lock);
> > + }
> > +
> > cond_resched();
> > spin_lock(&class->lock);
> > }
> >
> > if (src_page)
> > - putback_zspage(pool, class, src_page);
> > + VM_BUG_ON_PAGE(putback_zspage(pool, class,
> > + src_page) == ZS_EMPTY, src_page);
> >
> > spin_unlock(&class->lock);
> > }
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web