From patchwork Thu Dec 5 17:49:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Matthew Wilcox X-Patchwork-Id: 13895897 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BD57E7716E for ; Thu, 5 Dec 2024 17:50:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B5D656B0175; Thu, 5 Dec 2024 12:50:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 57EF66B0117; Thu, 5 Dec 2024 12:50:09 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CC8BD6B0180; Thu, 5 Dec 2024 12:50:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 0771A6B017D for ; Thu, 5 Dec 2024 12:50:08 -0500 (EST) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A48FE14187B for ; Thu, 5 Dec 2024 17:50:06 +0000 (UTC) X-FDA: 82861643508.23.FB55128 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf22.hostedemail.com (Postfix) with ESMTP id 206F0C0019 for ; Thu, 5 Dec 2024 17:49:46 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=qvbgNOYr; spf=none (imf22.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733420994; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=/rElCw5FqAKtEBYfTYEarV2wo4tbB8FYMNSzg+Qr0Lw=; b=lJZhZeO5jC2PDJDnjWvfmr0HWKz3l1ZCAMS7GGvFgvHPgzKYUQ6gegONi4D5CTb3XwRunk 9KjLApsGD+CA/JFv+id5ujv3eMu4Kz5zn+StYGCT1CEJGxgclkUpGhjm6fAxm8V2UeyOvI ZtTNAdinLlnUMfIsodB7VMhqJcq/OPM= ARC-Authentication-Results: i=1; imf22.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=qvbgNOYr; spf=none (imf22.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733420994; a=rsa-sha256; cv=none; b=oEicfLhes//8nmYqwmVSolOFt5y0FF+PWfLZLgD1MhSB6ylEUxl1+5tGxjik+J/DFYuOK6 joyI7SP0w0zZ1H/N+NsZNpoE7Ryg+A/WxV4owZlPNMAzbUP1cLmoBry/ppJ68vMWg2YFs6 cN8WaJXngpdKeBoM4rOWRpVoYsPNADQ= 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=/rElCw5FqAKtEBYfTYEarV2wo4tbB8FYMNSzg+Qr0Lw=; b=qvbgNOYrWEpPlJppZS0ylA9jU1 C+2Z2dX4C+aqkzqZEaFDo4rQbYpugtweWLFyJnRNhsoaukJQztMnwda7gKgb1uoljIYHK/j0I5GuL qpaovY/+zqeu1bHiejgD2qXAns+rAtXGioE579FTCPTP1Vm6qRmuJ/JhR4RBJM00x5bYxr5QbUX8D MXur2xPmWcvYnBw3NmMlS/m6oXr1nVlZ9wmrzFqpc/sy8RqmLZP0rTzQX63JPzI6JZ7k99B6no+8D lnz9GafgOWdWW2Mk0JEsi83cXPc10/5/uKG6xiJHqm0FY6qKEUpOpR0lxhEad0isMbGqU30BPlpNL YxEcdKkw==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tJFzG-0000000DN6w-2bak; Thu, 05 Dec 2024 17:50:02 +0000 From: "Matthew Wilcox (Oracle)" To: Minchan Kim , Sergey Senozhatsky Cc: Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, Alex Shi Subject: [PATCH v8 03/21] mm/zsmalloc: convert __zs_map_object/__zs_unmap_object to use zpdesc Date: Thu, 5 Dec 2024 17:49:40 +0000 Message-ID: <20241205175000.3187069-4-willy@infradead.org> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241205175000.3187069-1-willy@infradead.org> References: <20241205175000.3187069-1-willy@infradead.org> MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Stat-Signature: fiojpcyi5yr7pdsi44orjhzwns975sfi X-Rspamd-Queue-Id: 206F0C0019 X-Rspam-User: X-HE-Tag: 1733420986-621435 X-HE-Meta: U2FsdGVkX1/dLPdurBaiQ5fX9yMjls2ea3JYPSRV64jb1BvFx54fVFSV1x4tnacOJRUgU8zbZEq/EeakzNG6OHDMfK2v+wV4ZYCw4ibagM4mJ4C8BFoDB09aIEYGO3hr9UGi+Karb6t69ArwWe4YgYKMGofmJcgTcPu+WCaZcn0Lk7jAGI80I1eqo6uGZyZr9cGnxpS6tOZH7YO5WWbIwCjJf/dYSwAt0HZrcJvHxd6sdXleDICjxCms55k77YR0q7sQxPtWB27Dxca9M/MHCR9KvQvVR6zF/VDjDRPs+xpymu5bGyAna/O8AtNGGMsKKbijZgp6b7hystM7u+ZvwFzsfqoxLh7sYjZX/9wWeqDNGvQ8Wz811Az11zn5jrDeeMiJn6s7fKgkvYfB9/UHs4d+v+1XGTIW00H6Y3IsvkgduERUqnRhVcGYx7E39cuQjsggsyGeADWtUXo1KKa3J8m3C5lKwaJWxOx5Q87Ef0yROW45r0LSLJ/rZCuiYMFH1HvxB/eUGTHM6AoxUseBWnrBTmAPmXl0OF7m7Mi74HqB9g4+xK3aUBBiJTpXyiSKhEFkajYQIDK1vxYgDkdzD3Bhs96fdETzUNxGD2SOHguCZkml239LMW++p2G/yRIeXlZwGuGiWEr5kNUXn4tKgXEfWRxXjcq1AU6U0BPy/smYCkmahgoxSMaJ752tS/tQGWSc8i4KQsyhQRLbPoL36RnlqopMa3evXJzEM9ttGg83dzvMby+QRdowudxfd6AV2VhtWCe9ZG26LkesC3zTa7z6+R5A/zg4UnlelJBwv8UR5OpGgACDrvTQsZtszaHBjLt3Ow9rMpimcenZXiQqpouomzvUK6eTLZHpm3dgUAD6sl5AEdhloSsaY1vcyLrNyoTCTuOkoIxCeQOdefgMjRluhjEeiNp/WzyIR+6PpjyW6/YuRRSEyVnoJVHNbDmkryel1MUkrotNUlQjsUB nt/5Fl11 2Gv/faM62tTtxQp7orX6Z1jGXfx3tze94yZt3WOWsCcdlxw9guVv/adabp2RadbaA5tQKsLCq0tte24V3YHhS911ncADxq3W/ykmnwYZav+t36tzbhCropkdtUzDhaDzk9okYxwL6sD5pfB03gHODsgSilLvd6j7JTk2iSnuCRudgT7XksM/fMPC2Nytn9cLuoSTdqUpLdgdVsrwg/bV72jS6YivzucotPiSYtq1us7SrGff9nxlVBNgioi9XLappI3e6CMFPZJh8r9wgDtD0GwaEwqCFRBQ/lf7OGwy3livjkWCHl5a/pi2ysUyIHlWC+Y3+K/Eeehafcb57LEHDkM8zsQ== 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: List-Subscribe: List-Unsubscribe: From: Hyeonggon Yoo <42.hyeyoo@gmail.com> These two functions take a pointer to an array of struct page. Make __zs_{map,unmap}_object() take pointer to an array of zpdesc instead of page. Add silly type casting when calling them. Casting will be removed later. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 1d1dd4578ae3..5e6467c10757 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1067,7 +1067,7 @@ static inline void __zs_cpu_down(struct mapping_area *area) } static void *__zs_map_object(struct mapping_area *area, - struct page *pages[2], int off, int size) + struct zpdesc *zpdescs[2], int off, int size) { size_t sizes[2]; char *buf = area->vm_buf; @@ -1083,14 +1083,14 @@ static void *__zs_map_object(struct mapping_area *area, sizes[1] = size - sizes[0]; /* copy object to per-cpu buffer */ - memcpy_from_page(buf, pages[0], off, sizes[0]); - memcpy_from_page(buf + sizes[0], pages[1], 0, sizes[1]); + memcpy_from_page(buf, zpdesc_page(zpdescs[0]), off, sizes[0]); + memcpy_from_page(buf + sizes[0], zpdesc_page(zpdescs[1]), 0, sizes[1]); out: return area->vm_buf; } static void __zs_unmap_object(struct mapping_area *area, - struct page *pages[2], int off, int size) + struct zpdesc *zpdescs[2], int off, int size) { size_t sizes[2]; char *buf; @@ -1108,8 +1108,8 @@ static void __zs_unmap_object(struct mapping_area *area, sizes[1] = size - sizes[0]; /* copy per-cpu buffer to object */ - memcpy_to_page(pages[0], off, buf, sizes[0]); - memcpy_to_page(pages[1], 0, buf + sizes[0], sizes[1]); + memcpy_to_page(zpdesc_page(zpdescs[0]), off, buf, sizes[0]); + memcpy_to_page(zpdesc_page(zpdescs[1]), 0, buf + sizes[0], sizes[1]); out: /* enable page faults to match kunmap_local() return conditions */ @@ -1248,7 +1248,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, pages[1] = get_next_page(page); BUG_ON(!pages[1]); - ret = __zs_map_object(area, pages, off, class->size); + ret = __zs_map_object(area, (struct zpdesc **)pages, off, class->size); out: if (likely(!ZsHugePage(zspage))) ret += ZS_HANDLE_SIZE; @@ -1283,7 +1283,7 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) pages[1] = get_next_page(page); BUG_ON(!pages[1]); - __zs_unmap_object(area, pages, off, class->size); + __zs_unmap_object(area, (struct zpdesc **)pages, off, class->size); } local_unlock(&zs_map_area.lock);