diff options
author | Dave Airlie <airlied@redhat.com> | 2016-06-09 03:01:49 +0200 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2016-06-09 03:01:49 +0200 |
commit | fa625c1956830c826ebf13324c2b33fcabef7db0 (patch) | |
tree | 92c7f1272617c5c6a82478ba161af97eae0260cd /mm/z3fold.c | |
parent | Merge branch 'drm-intel-next' of git://anongit.freedesktop.org/drm-intel into... (diff) | |
parent | Linux 4.7-rc2 (diff) | |
download | linux-fa625c1956830c826ebf13324c2b33fcabef7db0.tar.xz linux-fa625c1956830c826ebf13324c2b33fcabef7db0.zip |
Backmerge tag 'v4.7-rc2' into drm-next
Daniel has a pull request that relies on stuff in fixes that are in rc2.
Diffstat (limited to 'mm/z3fold.c')
-rw-r--r-- | mm/z3fold.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/mm/z3fold.c b/mm/z3fold.c index 34917d55d311..8f9e89ca1d31 100644 --- a/mm/z3fold.c +++ b/mm/z3fold.c @@ -412,7 +412,7 @@ static void z3fold_free(struct z3fold_pool *pool, unsigned long handle) /* HEADLESS page stored */ bud = HEADLESS; } else { - bud = (handle - zhdr->first_num) & BUDDY_MASK; + bud = handle_to_buddy(handle); switch (bud) { case FIRST: @@ -572,15 +572,19 @@ next: pool->pages_nr--; spin_unlock(&pool->lock); return 0; - } else if (zhdr->first_chunks != 0 && - zhdr->last_chunks != 0 && zhdr->middle_chunks != 0) { - /* Full, add to buddied list */ - list_add(&zhdr->buddy, &pool->buddied); - } else if (!test_bit(PAGE_HEADLESS, &page->private)) { - z3fold_compact_page(zhdr); - /* add to unbuddied list */ - freechunks = num_free_chunks(zhdr); - list_add(&zhdr->buddy, &pool->unbuddied[freechunks]); + } else if (!test_bit(PAGE_HEADLESS, &page->private)) { + if (zhdr->first_chunks != 0 && + zhdr->last_chunks != 0 && + zhdr->middle_chunks != 0) { + /* Full, add to buddied list */ + list_add(&zhdr->buddy, &pool->buddied); + } else { + z3fold_compact_page(zhdr); + /* add to unbuddied list */ + freechunks = num_free_chunks(zhdr); + list_add(&zhdr->buddy, + &pool->unbuddied[freechunks]); + } } /* add to beginning of LRU */ |