From patchwork Thu Dec 5 17:49:52 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: 13895933 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 5A1D7E7716E for ; Thu, 5 Dec 2024 18:29:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB4B86B0096; Thu, 5 Dec 2024 13:29:14 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B63C66B018D; Thu, 5 Dec 2024 13:29:14 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A523F6B00C1; Thu, 5 Dec 2024 13:29:14 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 8866E6B018D for ; Thu, 5 Dec 2024 13:29:14 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 2F7D31216D3 for ; Thu, 5 Dec 2024 18:29:14 +0000 (UTC) X-FDA: 82861742166.12.FF1355F Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf29.hostedemail.com (Postfix) with ESMTP id 904DA120013 for ; Thu, 5 Dec 2024 18:28:48 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="cr/QlDlt"; dmarc=none; spf=none (imf29.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=1733423337; a=rsa-sha256; cv=none; b=cjY26ygJU0eH8R3yWvKChaNEu1n81JElhxRSBo+hqRU2ApCZqbM8isjdOcDB12NULXc8VQ KDuMlnwAybrJ46RndhdDhX8rJq4M4ZhCgXZo56HDWWPiZudUTSMG9n3sRWUKEJBu0uv7rI ab4zCGDaHrD60SPo8yNchPnAzz/d3ug= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b="cr/QlDlt"; dmarc=none; spf=none (imf29.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=1733423337; 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=vjWgaQhdgIZ5U15RH/nX3b3vESf852BAXj6Bv+8+rfA=; b=gABR2uZMLloyFKxRx/ZwuVvsYeXmcfA6EoBPUWf2HzxazR27PcpO+YAnloWdUB6rKHo86S dnwvzVCgaSy4Oep4wv+XSiDYPqYBoYSiIR9cscPBt7WLOxJNEE6H2Vx6VrrmRFuRjlkSMg i3KYipKxgBEy3coI7Gnawz3DHsPDq/0= 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=vjWgaQhdgIZ5U15RH/nX3b3vESf852BAXj6Bv+8+rfA=; b=cr/QlDltOCHAX3DUuQFK+WrNTe iex8wr8HcWU7zyno4zBHkVLHvi+w/IcwvQCrds1+8OX7r5k+n+r8n4tYtL4T/yc/01GknxmVNuBtY C/IZQHX7Q639QFnlg+JfEqJfyqq3ZOZN8n3KMrtGTgf1hgXM2pX6BU5XMp7q0butHkKRiSNZMNeGA iIKRt7fRPjoctniZdv/rFiNnedcs425OXSFUzocKfKcigf6FIpfCC/3NzVOCe7nIny8kqwXQQMxWx z22+Rtsfbqy32B49TQ49Ds/b87dOwV7HcNUpLRpnwZcSIcLaNFMKgD0kL3B2vShwbPBYCH9W+xj7X rI00S6JA==; Received: from willy by casper.infradead.org with local (Exim 4.98 #2 (Red Hat Linux)) id 1tJFzI-0000000DN8s-0DQH; Thu, 05 Dec 2024 17:50:04 +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 15/21] mm/zsmalloc: convert get_zspage() to take zpdesc Date: Thu, 5 Dec 2024 17:49:52 +0000 Message-ID: <20241205175000.3187069-16-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-Stat-Signature: bg9fcwjh5hnbmc7g3y5x6gqa797cz3x4 X-Rspam-User: X-Rspamd-Queue-Id: 904DA120013 X-Rspamd-Server: rspam08 X-HE-Tag: 1733423328-868654 X-HE-Meta: U2FsdGVkX18v0A/WSNej7zEEhaTI9iUtmeAiYxrqfsWoOFT+f9f3VXJbzRV30ai3pF3eLDjjQFVEE/LHlgm9rOCdclzusz4HJFfzjV/eNvuLCewuqZkLFpJeNB6bibyHC5VMtHxhSh+5otK6CADF/pBPSPDXYsIm0dGmVapW7FwWHGNSF7vZJqqvCWxi995D5Y8aY1fL9n/nPFokSVBY83hpIig7U1Xm7+dvPUb+RPa23/6qovIyaYP1RVXRQZokhWdGXKcy2SBGQO7Gp2zKhiNDu3sEWZ4OPkwryJrs4Lakocc6DB27o4FN8ToPhBssS20Y80f0iV/OoY8xvv3IBZmoz4+hPEd1sMHuu9tZRKirMqusjnVd4zWw8APWuZ8lFD1ifLmzY3lFkjyDWjgFhk2OIC6KpJGeIwT4tq64wLZnuOVDlf4CAH+X7OSMQsE9iOkXHYKtzaBa2O/mr0J/K/HUfeMO3O3HnNG3LXbgnhyzRkD5DY0qD+oiLqFU6sTHI1BFd6PxflJ4yqscp192o6o0r43lGeNusecpm5b3eTlo6LKAY6eTZ8Su6bX3N5QtDr4k43pzkE5QCbCa00H9jo0ze2Usd9rtutWlsIKwTAX4AbJepQotXwgOCcsEeYicHPGLZogF7io0wwA/F5e0Is7XRf8CT2S3sY2qyesnReiQ1jTMeAFhMSU5Hfv5cnG6OoVG658fJqNzsS0M5Iv/5zk0FY5WqBJtGgVKk8kQ8pc9LpbwXrDK8kNTGrVCdyZhGJPQF2d+z9Y7kTm3OZeXFNCbZ59vVd1M07oVgaAcapALBOl8+0GBG/taP6lfcjxxvPYm6VIizaq6HERtCgfRZSyWBIDVTe8jk8ZGR2me5FcbQjGGdDmZl1GRxTfHTosL1oONZnsrPahI/nkqnqR69BGijMeD1mqhDyu5bfRNVgnLQuMfkt1BpnSUnbo2Sp1LcT+Im8LiSwwRkE+cbVB 6VCQAuQg UNkK4B5qga0F3uuW0AN3vnAMflxo4e95jaKKm1QG8fE9O7pwi5kXQ/d0Uuae1f1sR7cX7sDdHFmkMukVBkxfkaPj/Jsg+mSvy/xhTPCTcsOx0dC4/3Q7RBhLBGIkWx3OuR8ISL/g3hWThEs1lGYpsvcAtF53IyVAKGnnZdLUGc9O2NmlHLu6a2RNWF+KuPWSXFPUMVr3YGQg4peI3jzcQzCAHqGPAnF1rrQUXIUU4aubTZ4oIi7Nrd8ONx1EWnMSczEgsMkRXd6tNn09QKXFWqwdfCMgJAEwClzB/g8+/qwAUisQadUOSh13q+BSXcQCL4vHW2i5tjZWnCOk11C1oT13cQA== 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> Now that all users except get_next_page() (which will be removed in later patch) use zpdesc, convert get_zspage() to take zpdesc instead of page. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 6b05d0a47ed7..bf1db07c58cf 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -775,9 +775,9 @@ static int fix_fullness_group(struct size_class *class, struct zspage *zspage) return newfg; } -static struct zspage *get_zspage(struct page *page) +static struct zspage *get_zspage(struct zpdesc *zpdesc) { - struct zspage *zspage = (struct zspage *)page_private(page); + struct zspage *zspage = zpdesc->zspage; BUG_ON(zspage->magic != ZSPAGE_MAGIC); return zspage; @@ -785,7 +785,7 @@ static struct zspage *get_zspage(struct page *page) static struct page *get_next_page(struct page *page) { - struct zspage *zspage = get_zspage(page); + struct zspage *zspage = get_zspage(page_zpdesc(page)); if (unlikely(ZsHugePage(zspage))) return NULL; @@ -795,7 +795,7 @@ static struct page *get_next_page(struct page *page) static struct zpdesc *get_next_zpdesc(struct zpdesc *zpdesc) { - struct zspage *zspage = get_zspage(zpdesc_page(zpdesc)); + struct zspage *zspage = get_zspage(zpdesc); if (unlikely(ZsHugePage(zspage))) return NULL; @@ -845,7 +845,7 @@ static inline bool obj_allocated(struct zpdesc *zpdesc, void *obj, unsigned long *phandle) { unsigned long handle; - struct zspage *zspage = get_zspage(zpdesc_page(zpdesc)); + struct zspage *zspage = get_zspage(zpdesc); if (unlikely(ZsHugePage(zspage))) { VM_BUG_ON_PAGE(!is_first_zpdesc(zpdesc), zpdesc_page(zpdesc)); @@ -1250,7 +1250,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, read_lock(&pool->migrate_lock); obj = handle_to_obj(handle); obj_to_location(obj, &zpdesc, &obj_idx); - zspage = get_zspage(zpdesc_page(zpdesc)); + zspage = get_zspage(zpdesc); /* * migration cannot move any zpages in this zspage. Here, class->lock @@ -1300,7 +1300,7 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) obj = handle_to_obj(handle); obj_to_location(obj, &zpdesc, &obj_idx); - zspage = get_zspage(zpdesc_page(zpdesc)); + zspage = get_zspage(zpdesc); class = zspage_class(pool, zspage); off = offset_in_page(class->size * obj_idx); @@ -1464,7 +1464,7 @@ static void obj_free(int class_size, unsigned long obj) obj_to_location(obj, &f_zpdesc, &f_objidx); f_offset = offset_in_page(class_size * f_objidx); - zspage = get_zspage(zpdesc_page(f_zpdesc)); + zspage = get_zspage(f_zpdesc); vaddr = kmap_local_zpdesc(f_zpdesc); link = (struct link_free *)(vaddr + f_offset); @@ -1498,7 +1498,7 @@ void zs_free(struct zs_pool *pool, unsigned long handle) read_lock(&pool->migrate_lock); obj = handle_to_obj(handle); obj_to_zpdesc(obj, &f_zpdesc); - zspage = get_zspage(zpdesc_page(f_zpdesc)); + zspage = get_zspage(f_zpdesc); class = zspage_class(pool, zspage); spin_lock(&class->lock); read_unlock(&pool->migrate_lock); @@ -1831,7 +1831,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, __SetPageZsmalloc(zpdesc_page(newzpdesc)); /* The page is locked, so this pointer must remain valid */ - zspage = get_zspage(zpdesc_page(zpdesc)); + zspage = get_zspage(zpdesc); pool = zspage->pool; /*