From patchwork Thu Dec 5 17:49:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Matthew Wilcox (Oracle)" X-Patchwork-Id: 13895901 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 B9711E77179 for ; Thu, 5 Dec 2024 17:50:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DE8006B0179; Thu, 5 Dec 2024 12:50:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6FCE46B0193; Thu, 5 Dec 2024 12:50:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1A4E96B018E; Thu, 5 Dec 2024 12:50:10 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id B605C6B017E for ; Thu, 5 Dec 2024 12:50:09 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 6B43D1C863C for ; Thu, 5 Dec 2024 17:50:06 +0000 (UTC) X-FDA: 82861643046.09.E99C2A8 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf21.hostedemail.com (Postfix) with ESMTP id 8DE591C000F for ; Thu, 5 Dec 2024 17:49:34 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=X77s57vN; dmarc=none; spf=none (imf21.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733420997; a=rsa-sha256; cv=none; b=QhHVO3eCaEoKcVPwh5xhPMA3RyD4a5vblKLENTnVJ9FYwOaVS1NdbcxuYQFj5HZdbJuR/0 JGEUEtSGIiur8O2QAbOTOYERLS2u9cmMMyymL2NWz0Ai1BI+fFPtEfCi+0ODAysOKhyRVX UnDckRCBTr8FE20AM/HvjfWlgF77QjU= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=X77s57vN; dmarc=none; spf=none (imf21.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733420997; 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=ytR2DMOpT9l70a9J16/2c3nlbTXk/DpV9lwOjz46sSI=; b=x4vjSZNxAsdFFdCQ8iVHMtlzts1YI5ddRi23dZO0lHxUNzQy8LbR0xDSmjaZC9oYFDe8WS cnG6iMoc5FUDlvoZfZku8jIOR5ab0iHyY4fK2MKLQ8/i0HI46Tr7bhu2GVbn/+ZMZi+S3e /nb7IiAxIjVAYupiCcn/DuYlEfuQEV4= 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=ytR2DMOpT9l70a9J16/2c3nlbTXk/DpV9lwOjz46sSI=; b=X77s57vNgrj4SiZG2HwYY+NOKa NLz70l2rDKSTtEfE+ogYZDUuXze/7HHCADFjN6RAL17cdl0a62zUbqBVgGZioFND1gvn3nnY6MkvO 12IUhQYJ7IctdG/fByrwJIqNM8WT/+usTU568xwCT5o5752BiQikYM6x4jrZHHO+vMdMwRvZmyv1I kFOZ77c4E+7Kk7+YhFPhAgHMkQ8lr9HqRG6PoVie/BTdZskxpD669oDVxkzXxulRJF2n4kYibPwwi gjL/DBPXkXl8lA84uiiVGiagtqI0DveDOFiNeutqxX4RuQKCrBd1lt5l86wqI4O+P+Nj+mbpE3Fw8 0BtFJa+Q==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tJFzH-0000000DN89-18Db; Thu, 05 Dec 2024 17:50:03 +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 09/21] mm/zsmalloc: convert obj_to_page() and zs_free() to use zpdesc Date: Thu, 5 Dec 2024 17:49:46 +0000 Message-ID: <20241205175000.3187069-10-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-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 8DE591C000F X-Stat-Signature: 3g1ogzwmy48tm9jgs8xysonhj79pxsge X-HE-Tag: 1733420974-996678 X-HE-Meta: U2FsdGVkX18C+mx/h/ZwqvY4dmwLRMQ99g64pUHHvuY6Qh167c6zB9ftkIUv8xhkJuty3s9dSPNMD0sugqeNY7Rd7/gqGuTPFq4a37U0YJOe5Drn0nCsugf7CYpJbxmRwDVCBsdS87/t3l0NIIh0OGHszdRiScJnQTf3eh+gnjDoCqMdS42yWugsLaYuSgkiqAmWKMt0RQ3FOqWTu+nblSJj4zVvd2kiPCJ8rUlYn93cCwhNuTKmJ+wWBqBRHyXB7erQ2W6EeNF9j04DSO9VDxoV2hh2TvAb0eVx7mbBKWgkQyEBwYKxkANBFUv+UR2AkNpR10XF0+VpMTB4rDgKqIg2PEM6oK2bA3zkyKFr/+eSWdpoeNZOmshzs3XPEcplU6dIy/zSHc6sIfcYRSdcYIHCRhKNRTq4t/ISBLoyCsj17D185Stnbk+GMFHkhMzK3GFQM9PlUXqkMSfUseuF2S2T1DL7/8wdSfg20fLwjB8Vd4FcA5As5khROdym9gzOfmDw5enkrmugFB2hcQRzH5DLtzXRBKIugf2sr7fu4Ux+ViSBE63u4R25gg6bLah2qbFFg+WcVaj96TaUCfjMOXnGKJcPNfNiSxYBStCSQCxG5/B7TqwTi1PKyZrrwnlw4PLcjCNFrQxc0dI1nqgf96DxAQkIaaa7RLboJLOIgTgUdg/MzcjmfYGNezPEPgMgZ/zBHCdEwmIlQBAe/IkE6YvJUt7obNlynREdLXvqYhkEesMsyZFqiABXw6a+RFojYbLvFPAg+Vr3DJi2rVk6GEcirqJvqPfztxzCYcnC+qw7YmvrqVT69Kq//esmKtw3dlvXoCI01gZmeRaPUsaDNAxN6dBTjtUE9ElIq4Ouq3OwfoL3TPtfJP1bCmiq+Pr3gMpqEklB+4CwuyPZuC+zxG3DD2YAzOIrRZnFbdwr2y45BwPCeIlq+mGz3yhASNS++XwqjnPb74TCSz55kQN CYgfbX3V 74Z63tRQnsX6JcSxmAGRUal8ayNhZofOwd/eO+HD1F4Za8/hNZtvd+dkZU6yd7BcjLRaLbprgR86M4bof2KJiqalcMjE75QBA3Q3QwDpXOi+9dOLzl2GyLP/IaJJ9nVSNwIi26ltKnBIrtVg3KhF7iAgGjCKovcoBZw0B2v3TKrEktyAYxGdr2NGNdv+PPF+oEr78sU+A6dpaumKcV7MFnQn8cHQh13ECZoRiU5fwLPp+26ycHJNIYIyzAixxKEwhltkdpTbQwr4xh9Ee9QDSscNNI05n1UyVt1vhAX4pwcgg9FtvuvpCBtk0XEYTC+duigSLKnAB0FiwVRG656ddSM+Tjg== 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> Rename obj_to_page() to obj_to_zpdesc() and also convert it and its user zs_free() to use zpdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index faaebc1514ed..6145f7169c67 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -816,9 +816,9 @@ static void obj_to_location(unsigned long obj, struct zpdesc **zpdesc, *obj_idx = (obj & OBJ_INDEX_MASK); } -static void obj_to_page(unsigned long obj, struct page **page) +static void obj_to_zpdesc(unsigned long obj, struct zpdesc **zpdesc) { - *page = pfn_to_page(obj >> OBJ_INDEX_BITS); + *zpdesc = pfn_zpdesc(obj >> OBJ_INDEX_BITS); } /** @@ -1481,7 +1481,7 @@ static void obj_free(int class_size, unsigned long obj) void zs_free(struct zs_pool *pool, unsigned long handle) { struct zspage *zspage; - struct page *f_page; + struct zpdesc *f_zpdesc; unsigned long obj; struct size_class *class; int fullness; @@ -1495,8 +1495,8 @@ void zs_free(struct zs_pool *pool, unsigned long handle) */ read_lock(&pool->migrate_lock); obj = handle_to_obj(handle); - obj_to_page(obj, &f_page); - zspage = get_zspage(f_page); + obj_to_zpdesc(obj, &f_zpdesc); + zspage = get_zspage(zpdesc_page(f_zpdesc)); class = zspage_class(pool, zspage); spin_lock(&class->lock); read_unlock(&pool->migrate_lock);