linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: zhouxianrong <zhouxianrong@tom.com>
To: linux-mm@kvack.org
Cc: linux-kernel@vger.kernel.org, minchan@kernel.org,
	ngupta@vflare.org, sergey.senozhatsky.work@gmail.com,
	zhouxianrong@tom.com, zhouxianrong <zhouxianrong@huawei.com>
Subject: [PATCH] zsmalloc: fix linking bug in init_zspage
Date: Thu,  9 Aug 2018 20:28:17 -0400	[thread overview]
Message-ID: <20180810002817.2667-1-zhouxianrong@tom.com> (raw)

From: zhouxianrong <zhouxianrong@huawei.com>

The last partial object in last subpage of zspage should not be linked
in allocation list. Otherwise it could trigger BUG_ON explicitly at
function zs_map_object. But it happened rarely.

Signed-off-by: zhouxianrong <zhouxianrong@huawei.com>
---
 mm/zsmalloc.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c
index 8d87e973a4f5..24dd8da0aa59 100644
--- a/mm/zsmalloc.c
+++ b/mm/zsmalloc.c
@@ -1040,6 +1040,8 @@ static void init_zspage(struct size_class *class, struct zspage *zspage)
 			 * Reset OBJ_TAG_BITS bit to last link to tell
 			 * whether it's allocated object or not.
 			 */
+			if (off > PAGE_SIZE)
+				link -= class->size / sizeof(*link);
 			link->next = -1UL << OBJ_TAG_BITS;
 		}
 		kunmap_atomic(vaddr);
-- 
2.13.6


             reply	other threads:[~2018-08-10  1:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-10  0:28 zhouxianrong [this message]
2018-08-13  6:05 ` [PATCH] zsmalloc: fix linking bug in init_zspage Minchan Kim
2018-08-13 10:55   ` Sergey Senozhatsky
2018-08-14  0:24     ` Minchan Kim
2018-08-14  0:51       ` Sergey Senozhatsky
     [not found]       ` <1784999539.213028.1534378242020.JavaMail.root@rz-web2>
2018-08-16  3:46         ` Minchan Kim
  -- strict thread matches above, loose matches on Subject: below --
2018-08-09 13:53 zhouxianrong
2018-08-09 14:41 ` Vlastimil Babka

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=20180810002817.2667-1-zhouxianrong@tom.com \
    --to=zhouxianrong@tom.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=minchan@kernel.org \
    --cc=ngupta@vflare.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    --cc=zhouxianrong@huawei.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 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).