From patchwork Mon Dec 16 15:04:46 2024 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: 13909893 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 F0D2EE7717F for ; Mon, 16 Dec 2024 15:06:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BC1416B00AA; Mon, 16 Dec 2024 10:05:58 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B47046B00AB; Mon, 16 Dec 2024 10:05:58 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9BF1A6B00AC; Mon, 16 Dec 2024 10:05:58 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 7B4BA6B00AA for ; Mon, 16 Dec 2024 10:05:58 -0500 (EST) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 4265680FCF for ; Mon, 16 Dec 2024 15:05:58 +0000 (UTC) X-FDA: 82901146020.06.3450BE1 Received: from mail-pf1-f174.google.com (mail-pf1-f174.google.com [209.85.210.174]) by imf20.hostedemail.com (Postfix) with ESMTP id 5E1DC1C0006 for ; Mon, 16 Dec 2024 15:05:24 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aLp3RrCx; spf=pass (imf20.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.174 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=1734361533; 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=FwgMAYvwWVg4yaueRgoT/AVCt+LMoOGVCN4pN7WQJmo=; b=sIpz4f6a1mdai8Ok8QelVQebNb6joGc4HgPfqteV4cgDc9/jxrCJwisYohMGN36uh2zWf1 VYrsKntnjnq+YaawrrYYUjcP1KRu9Mkk2HsLzcdeeEPjZ3dYXJQlK+I+h1pUEo7wBF1I37 P47imbC/9iFCSIk2KcmV4AUhDnLRmVo= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=aLp3RrCx; spf=pass (imf20.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.174 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734361533; a=rsa-sha256; cv=none; b=wruYs3sv3TY1iNZiH6NXWl/mKKUMCEw3ymXCepIVcln3uRzVjGmvNW7LkMWkTLM42dQ+Ah SaT9kXKO5woKpf786D1on8OkfRakEydChgXVyQ6ieiN46lzyx75AARjqXCi72QRceWyVuq LgB21OkzGVzMufHpOnmLdevJCwHFw+A= Received: by mail-pf1-f174.google.com with SMTP id d2e1a72fcca58-725f4623df7so3618380b3a.2 for ; Mon, 16 Dec 2024 07:05:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734361555; x=1734966355; 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=FwgMAYvwWVg4yaueRgoT/AVCt+LMoOGVCN4pN7WQJmo=; b=aLp3RrCxQ/6yrPEEqigSnmUJ5HfA5bhQg8xC3HkOi/cuYQ+r8fP9Z1rZByl6nDAyzz gAeGYGhekl9bd6CefK+MpFfTn3cNG0XUEBu5irx0C1nddUWqgJUpgGv940S7QuD8yWer bB09A+z3LaT+9f5s7zchT2Cb+US2KJ3ooStgQBR1svK91hkTnr3h9qIwNNAIucFKM/OH RJJC2fovOsyKskZiJ5lDD+posf9EfvHnXqTutMeH6qfURfglKvg3BGGy4T0hswOMjLKA BNyIhaSs9qcF4G7ax+VujNoPD0z9Pf+sxRIOtgEN0aymKkDZqPum3Mbl48+BC2UEc+IP cHxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734361555; x=1734966355; 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=FwgMAYvwWVg4yaueRgoT/AVCt+LMoOGVCN4pN7WQJmo=; b=Q8lVBcu96wgzLeJHA/p/Q/UgYeZUu0G1t7NIprQisFEgIG/70Pd73xk2C3/tPlAaQv oMwXBEO++gJhDQRqxoituyPt59I4f48uF8zW9ei38vHkptkna0hrKuV3uAV6kfRtFfrt PugRiCl5fRxWEDs3XF3ROSURixw/9392Jlv8NQdH2d89KCFT1/9gTK2T49HiWGTrC6a5 1LvNZ/iszUuLpCr8q3dW2PrfgFf86omXxcGMzFDbVE0UqpxypvH+y5XT5NFdmYvP6ro6 amL8HXgzwuPHt1a8iALax+RI6BfpaINzxMjyKZwgebswg3lPxKyrFH9q7kCi64dJq35H jRLw== X-Forwarded-Encrypted: i=1; AJvYcCXcTMK+JkZhpnndJJJELY2i/5mWPvCuGqTMvaT/OHoeK5FCnrYycIgaNp1aQomqHT9qmGcuS+ljDg==@kvack.org X-Gm-Message-State: AOJu0YzOgp1jlwb0KNJsCtvDJiSosVO38nAmy22DUjlVRfkZq8u6K7mb ktHwewtC3W8M5xjnDBvg/C1zLTdDkdCScsn0SrvE+tgM9kgbmsAy X-Gm-Gg: ASbGncsT7qWy/qbAc0yLFjYbwU8UisSHhb4jwBY5y+aBxyBpysHHjpfSbD/P/mCfBs8 OSbkLLak8C2voQwv6MVUwDKopVtv19wgj8VNyYTLhWzaRS2Vpl6eAxeg46B1iDM81ejRJUnlydO cntvG2UTmnQleN/ItnHiP/4vGHYkd9i/g9fMQSoc1sk2+LgEVaqEGVN4/JcAIJQW/iXYGgGhBBt e5uCvtMdRyN7ojb0GF4Xjt+ODs/gH7H9+w01zMJ80273Wa4wu2YP01MKoSxGikcqhg= X-Google-Smtp-Source: AGHT+IHxcNtWT37xGPAjfKBt6c+fDLiLp0VnvWHTPO/Ho3D8IRih6YUDGKHVePBI6Do2POU8c4CfAA== X-Received: by 2002:a05:6a00:c88:b0:727:3cd0:1145 with SMTP id d2e1a72fcca58-7290c0def0amr20406039b3a.2.1734361554548; Mon, 16 Dec 2024 07:05:54 -0800 (PST) Received: from localhost.localdomain ([1.245.180.67]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72918ad5ccdsm4845518b3a.74.2024.12.16.07.05.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 07:05:53 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Minchan Kim , Sergey Senozhatsky Cc: Andrew Morton , linux-mm@kvack.org, Matthew Wilcox , Vishal Moola , Alex Shi , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Alex Shi Subject: [PATCH v9 mm-unstable 15/18] mm/zsmalloc: convert get_zspage() to take zpdesc Date: Tue, 17 Dec 2024 00:04:46 +0900 Message-ID: <20241216150450.1228021-16-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: <20241216150450.1228021-1-42.hyeyoo@gmail.com> References: <20241216150450.1228021-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 5E1DC1C0006 X-Rspamd-Server: rspam12 X-Stat-Signature: ba7jybjz4qn1z5m15qw1oh1cg1t8uzyc X-Rspam-User: X-HE-Tag: 1734361524-678999 X-HE-Meta: U2FsdGVkX18HqSlxxoDuWUL2v6MKVVDFq5lh7tb3iXGgyfTCqthkYdR5JtcjK89cScLSg7EhgZnH+QRBjcqeDfi6lTR3tf5tD8aQmisHMXxBAqGk80jsqTJ1cIycGetq8j2CJIENoZCv69Magno225nxnD/w7Oy+827KItUwnv5SC3BnETZEl/kjdAGCwypjjxj5dDhWRxfnfJducytKYbu3IIBpEqUjTUiv+czUWlOOnEuMq70pe1InYrtcmBTICDBbJ700lO96Q2CHagZGT425OrhnLoWNrSG0Uu2QiC8HNgsL0R09sejmYGNANtbG+2nHz3tK5XYYhO6RN2TZ0vNPg799mz/mtwbQSbMbNlmxfbmotnfzxfCq9u/MCTG2uHLsGlAwELgqQKd/lX3yUZ7IewxmluT+Pi5E63dEWIA7HGTVU03B9q0AmrFXqAOND33zA0g+e6hjUob/3DFjEUkM0RoKqrp2/34KFXVlmTSLeyxAAaC30z5fZHwUtBk6jcs0q7+BmWa/jAGRQksofYi74H2/QWado+YXbMw7R63nc/cFX/oghMP/csWuidQR8tOSZElBTlyCXDAufess7zWUPxu0jD6EbYWUL2xBrG4mHt84KhCJN0/qRC7vhgd87K0zex81bxejjvdcv2j/TAIUe45ev/GmcX/fB4gRmxFb61SYQazLRK9Q6dcqRmrQvVYYzi9O5ysKbToZ5l2d97asOPppseAxtqsTndeS6dld7FqIu83Dj3c/SB0oJ5ceSYl5NDqDGyYIOhENZw/y3Hg410al8kGxb0hH8j7aWXYfO4dSiJkt213K7GUbYR5D+fJxSSkU7eL0B38uASqJIVfqHGuB1mor7DskOFcW+u7U24hIDtHOG2UIkjdZpwA+LnD/PeMNJDurEqITfUK3CBC5iHsICwxw0Z3ln0Pr3A11R5GLWn7V+UbgraPFf/CZAsxveBr9/Pu9+UK1RCw da4qqJW6 hVR/UUM2QsDbNSt7vP+pmKDIYX20ubOt8zWlBgy1TgbSUOw1EmzAKgsf+FwG6f6+H9zPD6a8EgKZM2BermDEaRN7GGhiiCtEJNOmps1U5RlS2p/t6l0o4C819/tOlVrAlvcXS4tTNn+p3QzSQvXZnlPfR3GK+HIM2XDTL7exTbO8xamFrd+4uAsT6xj2fshNY4GnLtdTYAOf9rIuyTkyau4IHdRLjOV+vnjypbNgwfA7+crqe1UUTVeZEpHWG45vijVtx9iFSRzPsZXu/LxXjZBAVP63fAt/edCf8MM2Yrh1SyEoIsl1rbuqFb9dkXhBPQu8Zg6CWqRI9MSQeVrHB+tD65X0e8tU7/lSRxsHoiafGhlPITH6BWtvqnlZwJRtejDMgPZZ6Syi/kd5XUAO3N6olmUB8/GbpwteDBlMmpFlTbbGlvZlQy97MYIRchRG+iD5VeXDWudSQ1FNFKOtwtQqV9yRyBj+Wx6pI+5Az0EJw5bUiPjmr2KE4O6HYZqUenwpRdrzYh1zoOZ2Hda368QlvrzxyqqaHySaKSl6W9OQPsyY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.425640, 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 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 19c1ca3957f2..a1a620192596 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -757,9 +757,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; @@ -767,7 +767,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; @@ -777,7 +777,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; @@ -827,7 +827,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)); @@ -1232,7 +1232,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 @@ -1282,7 +1282,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); @@ -1445,7 +1445,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); @@ -1479,7 +1479,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); @@ -1812,7 +1812,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; /*