From patchwork Thu Nov 30 10:12:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyeonggon Yoo <42.hyeyoo@gmail.com> X-Patchwork-Id: 13474215 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 79C85C4167B for ; Thu, 30 Nov 2023 10:13:56 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0DB778D003B; Thu, 30 Nov 2023 05:13:56 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 089B38D0001; Thu, 30 Nov 2023 05:13:56 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E6E728D003B; Thu, 30 Nov 2023 05:13:55 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id D1AD28D0001 for ; Thu, 30 Nov 2023 05:13:55 -0500 (EST) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id B0CB5A0129 for ; Thu, 30 Nov 2023 10:13:55 +0000 (UTC) X-FDA: 81514209630.24.E8DC81E Received: from mail-pf1-f176.google.com (mail-pf1-f176.google.com [209.85.210.176]) by imf14.hostedemail.com (Postfix) with ESMTP id B7EC3100005 for ; Thu, 30 Nov 2023 10:13:53 +0000 (UTC) Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=by2Kkczm; spf=pass (imf14.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1701339233; 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=mMaNyZ3L+HZw8TE4qwZHztb69egV4WdyDY+KH+9nP44=; b=ntuQnV/P+RHeawU9HccoKqOj8tQKwJS6A3X1TUaQPxmLG3eR6i591zpQ+44GFkUDZSt1rk 4bWvGIUexcT9Nu9r3ua2Rw5r7EfWsvs7nYgC1uYMh0H1YpcBA7b/yJTbxrcAWGfUElqzri n2/P7pP61gumKmNNAjbRl3ma1E2/1Tg= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1701339233; a=rsa-sha256; cv=none; b=gdVikWOlL6OfNiEJi2jHIaorZC2tYgp7Xa79eISZQnYS85IPpfZDc2bHy5Nsx89T/G3QMH EUGG6DInpYj+R0azGRqfHXmdtOAJWbb72+RBpgcJFGb1ZQpK0P+sAbhw6TOnrMY7q+Y/v/ 0mK879ESPujsNCVg58ZSdBRvO04L4eA= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=by2Kkczm; spf=pass (imf14.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.176 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f176.google.com with SMTP id d2e1a72fcca58-6cdd584591eso754764b3a.2 for ; Thu, 30 Nov 2023 02:13:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701339232; x=1701944032; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=mMaNyZ3L+HZw8TE4qwZHztb69egV4WdyDY+KH+9nP44=; b=by2Kkczm/LB3vDXmGal+wAsYTlhdn/23rvhrhu3d7DmPSi2QAYI/doLauXl7Si2Fvp 7pjRpEdZU6sH9nvNmWJK3e1o0OLMCeoPNjJ/70QxIyaZhjxs/kU/h+5nbwuAFPU3nxZE fhCoEPHTw38W8CZ4+guIpzvuWnSW7rQsLmTLoI6s9tt6wH6tt6b1wqcs82BCTB97zBJZ zwxPn4HZcOEmCExdvjIbzhAXMx1CT+i5Hv8eG/IylTa9PG+ha3xQprTJ3Vo20AkkAD+S pVaks62KSFCPe7JnrBEQX3pCrFf+UN913fs9wkYpTReBeRYiOF9tCV5FQzgbhTNSjRIY Sayg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701339232; x=1701944032; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mMaNyZ3L+HZw8TE4qwZHztb69egV4WdyDY+KH+9nP44=; b=VoD0Pu7LA6C5tGV5GEWyjQ9go/kj9jjnpcV9SNIOrtGLWKc2/Y/CVknxlvy8xDyiZF mwKqs95JGRrWIOp9eFM/h8lx38Fa907mrKdUNFqrGSNua1fVcIKLb8nrbP7HHuJcQLhq jkNur5yfHTd7CxBMCQMuYShHNNWBy9xnz4XkRU/LJtWA8/Dr2MYh/mg+x9U5IvxnOIFH PaJf23WcxBSXEggxkEo5ynH/hnu0FSbqyjNw+pKdfCzZHlbJfECFdYworcGBu3PVIE0Z l1xDdDnxxpTYAAJfdNlZ+uu4CTFzIh0PxNoTTHqnqxRDh+5pSDMNH7NmyT5BV55iWKB/ GllQ== X-Gm-Message-State: AOJu0YxRBcQYsMN6OP98hJ/q/lLwotI7TcoUKmDEI9rPrBEzJfFYJx58 6jqomcuKB00tONXkz8kqs/o= X-Google-Smtp-Source: AGHT+IGr54Tvv7uxT9fmYn+OarTAsfngkaoN0RH027eQiqR3aFqNa9flCesmMZle+RdVtI+9WPQ0lQ== X-Received: by 2002:a05:6a20:7350:b0:18d:4821:f754 with SMTP id v16-20020a056a20735000b0018d4821f754mr656115pzc.55.1701339232480; Thu, 30 Nov 2023 02:13:52 -0800 (PST) Received: from localhost.localdomain ([1.245.180.67]) by smtp.gmail.com with ESMTPSA id r27-20020aa78b9b000000b006900cb919b8sm841402pfd.53.2023.11.30.02.13.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 02:13:51 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Minchan Kim , Sergey Senozhatsky Cc: Matthew Wilcox , Mike Rapoport , Yosry Ahmed , linux-mm@kvack.org, Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [RFC PATCH v3 18/21] mm/zsmalloc: convert get_zspage() to take zsdesc Date: Thu, 30 Nov 2023 19:12:39 +0900 Message-Id: <20231130101242.2590384-19-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.39.3 In-Reply-To: <20231130101242.2590384-1-42.hyeyoo@gmail.com> References: <20231130101242.2590384-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Stat-Signature: afyspisw4fhy1ahjy6kz5p3hz85u1we5 X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: B7EC3100005 X-Rspam-User: X-HE-Tag: 1701339233-763837 X-HE-Meta: U2FsdGVkX1/z/1UGnMwTKyJ3uTMzr0yW+FI18JGGu3jDjfJhAnHscNtTzW3aOSTb3K4uHGWdhaiNxDSPrkKa3F/5Hx3LZJYCgjSh/1mrVztaD4nfqk/wWjvqqwcXFUNT8BtF7w105Iq4W/38c/bAIMhL9qmarkgx5SmVpiO5xZpo0TpOvhm8Nq5IbrFVe4OER8//tDmL794xNJ2BtDNMLf5swZ929UKeJLM2+vpQF1XkmNXm51KuwObZ416M6+U1h+DuTBrShGgbc8HF/OyagrJp/Z0tlK0TOVMa9CLURCNSxvB7Mw/+g2cYdj0O8mIGC4fFhq/FSaV21GkrWeRYXLfNTlUQfomcU2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PaiCV1dDBHNR9RhqP8w52LnqB0GdenaqiUskhAHNR27X8ZGFCMIHphhrNRlaFwk0l3CltcCyMD8KL17CY9o5YufZ25TNVj4nE+clM8sy+5QSFRT5BcLKwd3gSvgKgkx5jY1+ICt0ou+uGtIuZsXu08tGUZBp4Z6r2CQ== 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: Now that all users except get_next_page() (which will be removed in later patch) use zsdesc, convert get_zspage() to take zsdesc instead of page. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 91ff1f84455f..828c45eba8ea 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -903,9 +903,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 zsdesc *zsdesc) { - struct zspage *zspage = (struct zspage *)page_private(page); + struct zspage *zspage = zsdesc->zspage; BUG_ON(zspage->magic != ZSPAGE_MAGIC); return zspage; @@ -913,7 +913,7 @@ static struct zspage *get_zspage(struct page *page) static __maybe_unused struct page *get_next_page(struct page *page) { - struct zspage *zspage = get_zspage(page); + struct zspage *zspage = get_zspage(page_zsdesc(page)); if (unlikely(ZsHugePage(zspage))) return NULL; @@ -923,7 +923,7 @@ static __maybe_unused struct page *get_next_page(struct page *page) static __maybe_unused struct zsdesc *get_next_zsdesc(struct zsdesc *zsdesc) { - struct zspage *zspage = get_zspage(zsdesc_page(zsdesc)); + struct zspage *zspage = get_zspage(zsdesc); if (unlikely(ZsHugePage(zspage))) return NULL; @@ -976,7 +976,7 @@ static inline bool obj_allocated(struct zsdesc *zsdesc, void *obj, unsigned long *phandle) { unsigned long handle; - struct zspage *zspage = get_zspage(zsdesc_page(zsdesc)); + struct zspage *zspage = get_zspage(zsdesc); if (unlikely(ZsHugePage(zspage))) { VM_BUG_ON_PAGE(!is_first_zsdesc(zsdesc), zsdesc_page(zsdesc)); @@ -1381,7 +1381,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, spin_lock(&pool->lock); obj = handle_to_obj(handle); obj_to_location(obj, &zsdesc, &obj_idx); - zspage = get_zspage(zsdesc_page(zsdesc)); + zspage = get_zspage(zsdesc); /* * migration cannot move any zpages in this zspage. Here, pool->lock @@ -1431,7 +1431,7 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) obj = handle_to_obj(handle); obj_to_location(obj, &zsdesc, &obj_idx); - zspage = get_zspage(zsdesc_page(zsdesc)); + zspage = get_zspage(zsdesc); class = zspage_class(pool, zspage); off = offset_in_page(class->size * obj_idx); @@ -1595,7 +1595,7 @@ static void obj_free(int class_size, unsigned long obj) obj_to_location(obj, &f_zsdesc, &f_objidx); f_offset = offset_in_page(class_size * f_objidx); - zspage = get_zspage(zsdesc_page(f_zsdesc)); + zspage = get_zspage(f_zsdesc); vaddr = zsdesc_kmap_atomic(f_zsdesc); link = (struct link_free *)(vaddr + f_offset); @@ -1629,7 +1629,7 @@ void zs_free(struct zs_pool *pool, unsigned long handle) spin_lock(&pool->lock); obj = handle_to_obj(handle); obj_to_zsdesc(obj, &f_zsdesc); - zspage = get_zspage(zsdesc_page(f_zsdesc)); + zspage = get_zspage(f_zsdesc); class = zspage_class(pool, zspage); class_stat_dec(class, ZS_OBJS_INUSE, 1); @@ -1956,7 +1956,7 @@ static bool zs_page_isolate(struct page *page, isolate_mode_t mode) */ VM_BUG_ON_PAGE(zsdesc_is_isolated(zsdesc), zsdesc_page(zsdesc)); - zspage = get_zspage(zsdesc_page(zsdesc)); + zspage = get_zspage(zsdesc); pool = zspage->pool; spin_lock(&pool->lock); inc_zspage_isolation(zspage); @@ -1991,7 +1991,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, VM_BUG_ON_PAGE(!zsdesc_is_isolated(zsdesc), zsdesc_page(zsdesc)); /* The page is locked, so this pointer must remain valid */ - zspage = get_zspage(zsdesc_page(zsdesc)); + zspage = get_zspage(zsdesc); pool = zspage->pool; /* @@ -2056,7 +2056,7 @@ static void zs_page_putback(struct page *page) VM_BUG_ON_PAGE(!zsdesc_is_isolated(zsdesc), zsdesc_page(zsdesc)); - zspage = get_zspage(zsdesc_page(zsdesc)); + zspage = get_zspage(zsdesc); pool = zspage->pool; spin_lock(&pool->lock); dec_zspage_isolation(zspage);