From patchwork Mon Dec 16 15:04:34 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: 13909881 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 CAE4BE77180 for ; Mon, 16 Dec 2024 15:05:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5A03A6B0098; Mon, 16 Dec 2024 10:05:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 529CB6B009A; Mon, 16 Dec 2024 10:05:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3063B6B0099; Mon, 16 Dec 2024 10:05:21 -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 0CCBF6B0096 for ; Mon, 16 Dec 2024 10:05:21 -0500 (EST) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id C3856B064E for ; Mon, 16 Dec 2024 15:05:20 +0000 (UTC) X-FDA: 82901144676.30.206850B Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by imf15.hostedemail.com (Postfix) with ESMTP id 18464A0037 for ; Mon, 16 Dec 2024 15:04:37 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fKdAPv7z; spf=pass (imf15.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.175 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=1734361505; 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=lUn/gBv25T3Cd6KdLLN5Xt9D/fxWy2xIzcxbFVGSSxQ=; b=Bgu6Ye7DzcWNmsvPAzF7M6jF1eK1sc6ttT18XLpjpHuH5WkHxDWz4oypT+43o0DE6+r3aO Lld3fgkdKxLQlz4q0zL8Guupg2o/7icmgqdT5pI7QphtA2cAbJzmWiWJTNQVyo+l5CO6l7 Z/qTPeRlH8wTYf5U79Z3Hspno+mZ1yI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734361505; a=rsa-sha256; cv=none; b=iT2mxzQQqvYPthLxTUL5kPgnzeB/X3Eza7NkuDRrCTrKQcfUhEs9jAOinaO7K3s3DU5n1e eE2DGJCCVKMfiuHFeJQgdypNxEIa+Gqpt8VJtSF9e4QAkZGGmqmhbN2BajAHzEL5WHQVZe qZE3dAS823X8rfKQ4Yrevr3LVzNjqIA= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=fKdAPv7z; spf=pass (imf15.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.175 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f175.google.com with SMTP id d2e1a72fcca58-728f337a921so4383515b3a.3 for ; Mon, 16 Dec 2024 07:05:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734361517; x=1734966317; 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=lUn/gBv25T3Cd6KdLLN5Xt9D/fxWy2xIzcxbFVGSSxQ=; b=fKdAPv7zPDFGI8EURucK1vtWX/JaxTiAvdfskdcB8Ee9pMIPIong18GP5a22bxZbw2 TV5Vrq6zLK03Z7s+yc6BbE2WjzdYons15Wsolbahk7k8nLtO1+1HDT7KJkLY825M6ejq nRkB2ESqbMznhI2UGB7Qm7LLMExwjyqueX8M0WfTBfp9b/mBdjNxW/f0bTuDdRX7WwOL pSbUs/FWxws0PYNnOOqrFmTuc3lEoclGbEiqdMoMQCIK0R14aLuiZ5tsmU/+QVmtu2fx X0e5FixW3WiGmC/wmjFHi6tKbHGzpXOaTbAr/FYUt6fI9aNNMuQYBNqTU69sbR14sNsU 4/Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734361517; x=1734966317; 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=lUn/gBv25T3Cd6KdLLN5Xt9D/fxWy2xIzcxbFVGSSxQ=; b=LBrE/sELUW5FPaFosKZxiR75j+8qsKuK6Rvb+FhnPP8S5R4sIuXUkNc/NKxkjaMXiz KaZVXuMx/zV8tJeJxt+j7+tgW4jB608yju4ypUsg73KhqYiCL0iHdIdr7QRfvgEBY+8g ktG7tTIMhWZLvw9hXpHDZ98CeRGUITvyOGjQ8PprgJnlz5XZsbn+uIbguZXb8RxLSySw epA55uON1yETR9rGSwNewEan+y0so8qDcsY4IGnmoa1+TjQWB50dQGm/8G2H7Sn+ga3U SBs+EhkPwfuBHMSQdrzVpQYMXXjpL/GbTLusvoQW2JHOFE4a1508sRa+2c2ogbJKhKtm zWEw== X-Forwarded-Encrypted: i=1; AJvYcCXlEj3Zf4MWpqLmbawvFqBhVCUJZkvA3JEQSnWT30QUEPSV9miI+Mrse7l9l7cOjQtrWaMpLnhzng==@kvack.org X-Gm-Message-State: AOJu0YyAH0/qYcCpnq9Be2VfbvzbA7q0frYzpibdIx5McWnbIDIHgpBE SdCM4AMJDmPFlhGRcN9kr7PX7hdrL4BZq5QspLBdavLmsn1/LExx X-Gm-Gg: ASbGncvRGKETfHg5kDqjptXEKSk5V2oFReNwIlPnu9OH5wIm1rFi/Ym0k3NNthXkiO3 PFpNVOkzuTKxMHcy21zfB2sJylaqphQ3pyaz5ABQGR8/gZgA67j03vbMKFamR651f890u/42QQ3 0QcnV0BfXulV3vCTQTmwtFRpMPyK7nESlh8MijzuKKnuw+hgG9IfYWvFH/kRFM5alrM3z9FZOlK Dc9w1S3e09DFps8OkVMuffCe3yO128eAtaBgvhYv4fg7cmLgPVsAFOv7Yk3bgrkpoA= X-Google-Smtp-Source: AGHT+IEGJH+oTC4wITxq7ixqlLM3e/HIvJgSUVhaR4neTLa+rWu7QZPqzRa6GZ1WceIz+lNNlZJydA== X-Received: by 2002:a05:6a21:6da3:b0:1e1:a9dd:5a58 with SMTP id adf61e73a8af0-1e1dfdee4d9mr19642448637.30.1734361517516; Mon, 16 Dec 2024 07:05:17 -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.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 07:05:16 -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 03/18] mm/zsmalloc: convert __zs_map_object/__zs_unmap_object to use zpdesc Date: Tue, 17 Dec 2024 00:04:34 +0900 Message-ID: <20241216150450.1228021-4-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-Server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NND4r8 rN6vUTyiMQgMHMpzwMuOMwepj/n1yhjXNJ2B+k353SdaAd5j+DQFUalQlN/9Ps4LUZZ5ujgPwtTC/+IoV5j6RRqSv93VPvRzYmetz37t0QmB85J4542+5j9KGqaSyXOnHwNHUBpHgHayod4Hy6xzrvoxy91lJ0iSE05ulNoUc35NpC6B11YambM7KSbcvhen9nWG9lVhbuyyFiNjWnk2Inbclr2ge+pc6lIi35yQ5BVYXVsA0A6mB/cFkIp1Oj46IhUHfe+ByK3jgTudtrRaupZ59YriRdqK0USRgXvfmuhJDQsKb2pBUlxUKjTXHYIy0SZeMETC4Q3iMr041aY/xdDgq/jjigATaNx7ZrUuSA/2sD66Gt9vi5leW23MnuMAtBv8qaHsEg0XM2nOUVvC2eJUYi2qBZB8b251NGf2iYBOCcwhsXelr8uIcjExIP0s9rAooP+5RAqMvj5tyzb4pi8keUc2a9N+f+c9kXaU03KX40yjruhGa7qSDrhFDJ0XcyLglp6oMwI8YUoyrgPFPyhDwh0K5WuhWNIKZLFIyacNdA04= X-Bogosity: Ham, tests=bogofilter, spamicity=0.347014, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: These two functions take a pointer to an array of struct page. Make __zs_{map,unmap}_object() take pointer to an array of zpdesc instead of page. Add silly type casting when calling them. Casting will be removed later. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 51f4a9b78023..c038caaef3a8 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1049,7 +1049,7 @@ static inline void __zs_cpu_down(struct mapping_area *area) } static void *__zs_map_object(struct mapping_area *area, - struct page *pages[2], int off, int size) + struct zpdesc *zpdescs[2], int off, int size) { size_t sizes[2]; char *buf = area->vm_buf; @@ -1065,14 +1065,14 @@ static void *__zs_map_object(struct mapping_area *area, sizes[1] = size - sizes[0]; /* copy object to per-cpu buffer */ - memcpy_from_page(buf, pages[0], off, sizes[0]); - memcpy_from_page(buf + sizes[0], pages[1], 0, sizes[1]); + memcpy_from_page(buf, zpdesc_page(zpdescs[0]), off, sizes[0]); + memcpy_from_page(buf + sizes[0], zpdesc_page(zpdescs[1]), 0, sizes[1]); out: return area->vm_buf; } static void __zs_unmap_object(struct mapping_area *area, - struct page *pages[2], int off, int size) + struct zpdesc *zpdescs[2], int off, int size) { size_t sizes[2]; char *buf; @@ -1090,8 +1090,8 @@ static void __zs_unmap_object(struct mapping_area *area, sizes[1] = size - sizes[0]; /* copy per-cpu buffer to object */ - memcpy_to_page(pages[0], off, buf, sizes[0]); - memcpy_to_page(pages[1], 0, buf + sizes[0], sizes[1]); + memcpy_to_page(zpdesc_page(zpdescs[0]), off, buf, sizes[0]); + memcpy_to_page(zpdesc_page(zpdescs[1]), 0, buf + sizes[0], sizes[1]); out: /* enable page faults to match kunmap_local() return conditions */ @@ -1230,7 +1230,7 @@ void *zs_map_object(struct zs_pool *pool, unsigned long handle, pages[1] = get_next_page(page); BUG_ON(!pages[1]); - ret = __zs_map_object(area, pages, off, class->size); + ret = __zs_map_object(area, (struct zpdesc **)pages, off, class->size); out: if (likely(!ZsHugePage(zspage))) ret += ZS_HANDLE_SIZE; @@ -1265,7 +1265,7 @@ void zs_unmap_object(struct zs_pool *pool, unsigned long handle) pages[1] = get_next_page(page); BUG_ON(!pages[1]); - __zs_unmap_object(area, pages, off, class->size); + __zs_unmap_object(area, (struct zpdesc **)pages, off, class->size); } local_unlock(&zs_map_area.lock);