From patchwork Thu Dec 5 17:49:50 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: 13895898 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 B23F1E77170 for ; Thu, 5 Dec 2024 17:50:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E813C6B0188; Thu, 5 Dec 2024 12:50:09 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 797116B017C; 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 F05866B0188; 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 061236B0175 for ; Thu, 5 Dec 2024 12:50:07 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 9C626AF51A for ; Thu, 5 Dec 2024 17:50:06 +0000 (UTC) X-FDA: 82861643382.06.A29A132 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf18.hostedemail.com (Postfix) with ESMTP id CC25A1C0008 for ; Thu, 5 Dec 2024 17:49:57 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=gocPOtoL; dmarc=none; spf=none (imf18.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=1733420990; a=rsa-sha256; cv=none; b=nijN0IB4RLTKxRwiD0GGgEnm98xTVeJrnK33An4nDV+M1zwN98gJo9a8jqjfirnzF4QZ6C bT7PvtnoA285EXhj1Xb7BT4z94FjG/aL3wU428CufdYLPpEYroNZnehc50Seo2oQ9gf2LS kti/D6A2ijg4G4MSCNJglckAqXNCX3k= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=gocPOtoL; dmarc=none; spf=none (imf18.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=1733420990; 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=v1D7rbUNhCE1bX9EOMFHnijZuqUzg7mt/pt8cCRyQ4o=; b=0GoGV1TH2HQ/8Zv26iB5yIXnH3DpiEUQ7RYscTp5zn/vb0rojPmZZy5eOssBLFFM8OscM0 KLh8f3Se+fLhceXiT/4v/p1UZkv9Q6UrqXehNEAeOd8UPBXOebILyiebEVfzjsy6TVkYiM FvIULtZ2uDSmNANDj8AqmHyIF9f6sl4= 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=v1D7rbUNhCE1bX9EOMFHnijZuqUzg7mt/pt8cCRyQ4o=; b=gocPOtoLWxs4c+F/5+VlLX4O+r 2K7KcS3yTFsdYJBk8bKpzRBbtVy6kBs9VZskE5aCia6i/G25BpJrmdFFZ2uuiywgknyHBiGJuuXsq yNYCfsmNAtrU+olZJy3JrztPt4iRvbofyi6Ij80WeARfUu7TeIYeO29r+fN7HDfAX/4U2y7MYkuLY 6YbnfG5Mb+Tw0eZFQAZgBZGt1XlgwfYE+kaLLYuNSGgU6G5Hlun5lHiArinoEzLQOkDPSThsl/+G7 4wOSLlchMd3xUf2TABTks0WvSUiy8wNrvGcJyycBZCAatSNznbHRwSxWzQYMxZ1rfavYDTA0ZK34D ZQGZHr5g==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tJFzH-0000000DN8e-3PgI; 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 13/21] mm/zsmalloc: convert location_to_obj() to take zpdesc Date: Thu, 5 Dec 2024 17:49:50 +0000 Message-ID: <20241205175000.3187069-14-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: rspam04 X-Rspamd-Queue-Id: CC25A1C0008 X-Stat-Signature: k9qzhx5w1op6u8xymjozx5qcoyorc7dt X-Rspam-User: X-HE-Tag: 1733420997-523985 X-HE-Meta: U2FsdGVkX18mBwIWbXh+eEYhMidhZ+8sptq89jtTzQDwV1G73fCkA8u/dAbuqFs20WyAYWn5zCK+efX74ygSLkD2FORUoKDSDMSf6RH4jjnOi/7bSq1c1YnsJX3LK9Qu92ThqC79IuNP7OGPFfATaxMFcec9S4zbm7+MNBJBB92AeNoLyzP5EP9JjVLIdODNJDAu7Nnk7QbeT2yE3LKwX/u53xLYVaJeDkto1daQeNhlHmbh0K1vkNsHctOs44jJSVP7ANkA1mCRAOre41XxBm7JIOlFKSg9qtt+Ch9cm+BlcMVHtkdpIt0GQpexfxUNANeJquGyrAJpVcHlhhPNKjN1Ubq4jXV3IWE1HKlCR2sdTegm4k9ArrEOgDfI37R7Far2kMImEy2+B2hHkfdxjAPCQI06sZHiwLYjuubAPJBsyrgqiLQvkxMU2JlvsDE5le9/tJuqa7mmZrZGCcKweatOdwWUhVEQsg+XiPZdqxWPcgGN3F55ne+4DsF9449nfh6YXSIyTHuWGCvyUaEWXSjFWFIWMYpb52toGoOcUDsdE/gfYhXnMZ9LcBjtv36mWEcAUrE6xt2zTAvdgtWf9opUhEqEGnJmof5zw6BV6/M+SPTXr3DscCYxXS0EJVoKk3jdw0sOvB7G1SRwKxy4urE13Gz3eRr8zrWs7asfdqh7WQFT7MJIYCSr90BRElsbOPY14Uhr6bfGQGZ/6mN06JHvy+UfloSiAPrKgQsuMdtqe72KE8dRRhJvjCkMwhG3ZHz7aXsy1P6DLKu744gjpD2xHuJbt0eEsUeEubnmoXPs85dpgfO8JM+MiL/NRzou9WyqA/k0W1vztN0prkHcW2c/ZucKxefJi7r0oKxfbBuFlYSLpUruLCA7m6hIpv/T529MS9ct5qcnX53n5zUKS6KLk2JNa5gB0Gjw4Z+PRYNMgy8jDOg+iHqnBO4fjSggtc6nfAtW0kwyQU9yMOK h1aFdiq3 xPJRfmXsA7naSaBvx4VUESOeDZKHprivDly0BdtKQsqGWbE8Wl8XT910irOftF6Ih/Dza+7lIHNFR7FTBckvabaOzlnSu2ffvZSIpMNou+Nbv3PqR083a+W/6G56txInwQt7YTXKe7VlCIu7zUC0RmBbgovvXzyb3Sce0pd0r6H/PFMDwoOYtPN315Zy9ggBktSgU9EH+w/RjM+qhU2Spiz4ortZahYWbwAFcDEFHQFM9wzxX3DpBPWHu6BjlDpSRnlTBfaOuJxkESPfG2H3tGpQqcOjBvRUCDvGz99zBgsZrNHz/+leUv0OYC54SIl8lfFAYAwSUGYOh6VcS1esPYXwEKw== 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> As all users of location_to_obj() now use zpdesc, convert location_to_obj() to take zpdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 2932351f4698..2960258c9cda 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -822,15 +822,15 @@ static void obj_to_zpdesc(unsigned long obj, struct zpdesc **zpdesc) } /** - * location_to_obj - get obj value encoded from (, ) - * @page: page object resides in zspage + * location_to_obj - get obj value encoded from (, ) + * @zpdesc: zpdesc object resides in zspage * @obj_idx: object index */ -static unsigned long location_to_obj(struct page *page, unsigned int obj_idx) +static unsigned long location_to_obj(struct zpdesc *zpdesc, unsigned int obj_idx) { unsigned long obj; - obj = page_to_pfn(page) << OBJ_INDEX_BITS; + obj = zpdesc_pfn(zpdesc) << OBJ_INDEX_BITS; obj |= obj_idx & OBJ_INDEX_MASK; return obj; @@ -1377,7 +1377,7 @@ static unsigned long obj_malloc(struct zs_pool *pool, kunmap_local(vaddr); mod_zspage_inuse(zspage, 1); - obj = location_to_obj(zpdesc_page(m_zpdesc), obj); + obj = location_to_obj(m_zpdesc, obj); record_obj(handle, obj); return obj; @@ -1864,8 +1864,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, old_obj = handle_to_obj(handle); obj_to_location(old_obj, &dummy, &obj_idx); - new_obj = (unsigned long)location_to_obj(zpdesc_page(newzpdesc), - obj_idx); + new_obj = (unsigned long)location_to_obj(newzpdesc, obj_idx); record_obj(handle, new_obj); } }