From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9FCEC433EF for ; Mon, 4 Oct 2021 15:01:22 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3CCC3611C0 for ; Mon, 4 Oct 2021 15:01:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3CCC3611C0 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvack.org Received: by kanga.kvack.org (Postfix) id C4713940059; Mon, 4 Oct 2021 11:01:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BF4AC94000B; Mon, 4 Oct 2021 11:01:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ABD19940059; Mon, 4 Oct 2021 11:01:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0204.hostedemail.com [216.40.44.204]) by kanga.kvack.org (Postfix) with ESMTP id 9B42994000B for ; Mon, 4 Oct 2021 11:01:21 -0400 (EDT) Received: from smtpin02.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 5B10E31E5A for ; Mon, 4 Oct 2021 15:01:21 +0000 (UTC) X-FDA: 78659068362.02.7D5F8DF Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf13.hostedemail.com (Postfix) with ESMTP id 590E510393D8 for ; Mon, 4 Oct 2021 15:01:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=u+vBceyo13JEcf0ozoosSbSNeRLOKgeq1n0urmoRMn0=; b=cSnHpjsFmezAxq5CQolfnk4mnm +4JN+rbctnOLjz36BnutTxx779Md/rpTzwzn04f3W75fla6Du+n2pCnWzmxqzYN4pU1jY4z8/nKFv NV82ItsIgLeOfuS5ZhB775iYB/P401uypxqGUVW8/4fJTycE4zlGdw5i3bWTHTSHZqnKXUDimjuVA Exond2QxnBXKur5ZTrfUrREepD8YTyF820zRpXzN9KMgJJ9RAYG4/kgN/19TBXaNEERS/RADOVtKQ gFQipMGDEIzyVc6YGKBGdlGOz+XkbH48qEcduKIwKoKRQ0Htugedp7ysrTD3fkO3sPYv1ctqZDf/u nNVLX6+w==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1mXPQd-00H2Al-3j; Mon, 04 Oct 2021 14:59:09 +0000 From: "Matthew Wilcox (Oracle)" To: linux-mm@kvack.org Cc: "Matthew Wilcox (Oracle)" Subject: [PATCH 59/62] zsmalloc: Stop using slab fields in struct page Date: Mon, 4 Oct 2021 14:46:47 +0100 Message-Id: <20211004134650.4031813-60-willy@infradead.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211004134650.4031813-1-willy@infradead.org> References: <20211004134650.4031813-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 590E510393D8 X-Stat-Signature: zrtz4mdc9ggkkthn3jbmmdbr9ccrdqg5 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=cSnHpjsF; spf=none (imf13.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-HE-Tag: 1633359675-724931 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The ->freelist and ->units members of struct page are for the use of slab only. I'm not particularly familiar with zsmalloc, so generate the same code by using page->index to store 'page' (page->index and page->freelist are at the same offset in struct page). This should be cleaned up properly at some point by somebody who is familiar with zsmalloc. Signed-off-by: Matthew Wilcox (Oracle) --- mm/zsmalloc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 68e8831068f4..fccb28e5b6bb 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -17,10 +17,10 @@ * * Usage of struct page fields: * page->private: points to zspage - * page->freelist(index): links together all component pages of a zspage + * page->index: links together all component pages of a zspage * For the huge page, this is always 0, so we use this field * to store handle. - * page->units: first object offset in a subpage of zspage + * page->page_type: first object offset in a subpage of zspage * * Usage of struct page flags: * PG_private: identifies the first component page @@ -489,12 +489,12 @@ static inline struct page *get_first_page(struct zs= page *zspage) =20 static inline int get_first_obj_offset(struct page *page) { - return page->units; + return page->page_type; } =20 static inline void set_first_obj_offset(struct page *page, int offset) { - page->units =3D offset; + page->page_type =3D offset; } =20 static inline unsigned int get_freeobj(struct zspage *zspage) @@ -827,7 +827,7 @@ static struct page *get_next_page(struct page *page) if (unlikely(PageHugeObject(page))) return NULL; =20 - return page->freelist; + return (struct page *)page->index; } =20 /** @@ -901,7 +901,7 @@ static void reset_page(struct page *page) set_page_private(page, 0); page_mapcount_reset(page); ClearPageHugeObject(page); - page->freelist =3D NULL; + page->index =3D 0; } =20 static int trylock_zspage(struct zspage *zspage) @@ -1027,7 +1027,7 @@ static void create_page_chain(struct size_class *cl= ass, struct zspage *zspage, =20 /* * Allocate individual pages and link them together as: - * 1. all pages are linked together using page->freelist + * 1. all pages are linked together using page->index * 2. each sub-page point to zspage using page->private * * we set PG_private to identify the first page (i.e. no other sub-page @@ -1036,7 +1036,7 @@ static void create_page_chain(struct size_class *cl= ass, struct zspage *zspage, for (i =3D 0; i < nr_pages; i++) { page =3D pages[i]; set_page_private(page, (unsigned long)zspage); - page->freelist =3D NULL; + page->index =3D 0; if (i =3D=3D 0) { zspage->first_page =3D page; SetPagePrivate(page); @@ -1044,7 +1044,7 @@ static void create_page_chain(struct size_class *cl= ass, struct zspage *zspage, class->pages_per_zspage =3D=3D 1)) SetPageHugeObject(page); } else { - prev_page->freelist =3D page; + prev_page->index =3D (unsigned long)page; } prev_page =3D page; } --=20 2.32.0