From patchwork Mon Feb 20 13:21:59 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: 13146434 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 DEF3DC636CC for ; Mon, 20 Feb 2023 13:22:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D73E6B007E; Mon, 20 Feb 2023 08:22:53 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 787A66B0080; Mon, 20 Feb 2023 08:22:53 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 64F186B0081; Mon, 20 Feb 2023 08:22:53 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 568776B007E for ; Mon, 20 Feb 2023 08:22:53 -0500 (EST) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 24B4E120435 for ; Mon, 20 Feb 2023 13:22:53 +0000 (UTC) X-FDA: 80487735426.17.E3917FA Received: from mail-pl1-f181.google.com (mail-pl1-f181.google.com [209.85.214.181]) by imf26.hostedemail.com (Postfix) with ESMTP id 31091140011 for ; Mon, 20 Feb 2023 13:22:51 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CY+FN2dA; spf=pass (imf26.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.181 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=1676899371; 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=juu7JZAgQxY5cld5OKVOucJJE9jEtb+tt2neD2yXqiI=; b=rtYoiE5gQVgW7M/aPJWw5xVcfsCguk40MMyjz1vPbV8tZVoDVSufc0Rkzk1pCQSuaS4Ipq RIO44QFZ6tgluRiGEQtCqF44NhBtoCe1mccsAWY9VU0TWcNm2yt9sW+W8TL940t/hq4Ac9 uXg1Uo9n1BB12ms9OS97Xy3QNltKUi4= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CY+FN2dA; spf=pass (imf26.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.181 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=1676899371; a=rsa-sha256; cv=none; b=QoWRndo3izyACSib6saA8qb+SvPAekLaF5zs42zvZICcVXaL6skYDk+68z84WgtBsBbclM 5bY769KOfxEdLiOkxWrtjFbHvwpVoTIXOJTBIlvTMmemFLUO2R9imjRaYD5xteJtTqp0im WZ6HG1sK+C5pEgOA3Ii/k5pDTJNwsKA= Received: by mail-pl1-f181.google.com with SMTP id q11so1664467plx.5 for ; Mon, 20 Feb 2023 05:22:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; 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=juu7JZAgQxY5cld5OKVOucJJE9jEtb+tt2neD2yXqiI=; b=CY+FN2dAwa7IZKgOsgVrCdROAFo+gk+8zZCRn0yuDmBVghOqzCN4XtsD/Y/5p3lcei o4fUItQgE30yzw5oQP4aZEi7WLABsSORrr3WgmBhZO6FikowNbOVnG3pfgO7fMidtFa5 Q1bXXfRi/cNMr8hc0/2x8GbsNy990SsqFB6PXDD2xYJQeQ9OKqvUXmoWADtpLoXS7+Eo MXlNKQcEEyTmVXlKdnBUGoVT0vUR1ZP/BrTTgpVvLiukrDii+M2V5OnYiHMqpeB+zt99 lx26RmzoFnA36CgH6DXwvMrJ3n/hJy9g0m+mlOWz8LyfMcPnsmQBhEpqj/YZdgw3pGEp EEbw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=juu7JZAgQxY5cld5OKVOucJJE9jEtb+tt2neD2yXqiI=; b=tLJE9ogR3xJqYJ1oSCz8zLjmB8YZvv1nnLFMCnpCEoJIcM6k8K90qaIDh25OQO1eki nN6MNnkBpFeRTHubUtxp+F/Fs0sBIeje3fUOm0AorHc0UHHFa1Hh1XWPbR1PZURO+iHc x6WGow8H7eA1l7ahvqgXuvdUC902DppqaojmHTysShRI00QNBM41hyzuKV2GdXJUXHsi 6eCebt3KQQqyi3cgcy1RCa6PfdH2AaUQQjBLXNluPbzTb/yNXgToARzwJ08rfly3XTNp SsqGAOIhjXf2MLMrInzaEBE6qupsScSpHF6BenCfHqXXGeVFLZU2pJC4htfrqtl5GKHt dveA== X-Gm-Message-State: AO0yUKXq/OfN1zbH/5l4nxQnbvRqrsbZsATu9xvcqCYH9BWGBqq34gpS YhGHAcl2cG10zCISKsIZ7ys= X-Google-Smtp-Source: AK7set80FS3PeBhRDD9FEXKZEavXU+lFgI6EfW9xS/PTGxNSGOt8pBy/ybrWdxGsgNM0RC+usoZX+w== X-Received: by 2002:a17:902:9887:b0:19a:b683:e11b with SMTP id s7-20020a170902988700b0019ab683e11bmr163455plp.23.1676899370096; Mon, 20 Feb 2023 05:22:50 -0800 (PST) Received: from test-ha.kr-central-1.c.kakaoi.io ([210.109.63.229]) by smtp.gmail.com with ESMTPSA id x2-20020a170902fe8200b0019c13d032d8sm6125436plm.253.2023.02.20.05.22.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Feb 2023 05:22:49 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Minchan Kim , Sergey Senozhatsky , Matthew Wilcox Cc: Andrew Morton , linux-mm@kvack.org, Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [RFC PATCH 06/25] mm/zsmalloc: convert __zs_{map,unmap}_object() to use zsdesc Date: Mon, 20 Feb 2023 13:21:59 +0000 Message-Id: <20230220132218.546369-7-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230220132218.546369-1-42.hyeyoo@gmail.com> References: <20230220132218.546369-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 31091140011 X-Stat-Signature: t68qgp6fmqhyh69rueoz4sado3ouybau X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1676899371-952377 X-HE-Meta: U2FsdGVkX1+qPwUqWpuBtu6vFeHTrn44tjBxHAVWhADxKpYFhsPtZULlD7vUxFyChjRN7lrU2RWR4tamBtmwtX1FYSpGn1W2dcm0/jq9KDJUzMrIWQDEIOJQDXANuzAuERxOlBs4MGwOO2MvX3tJYBrCRsOTYebgwOaY48rTiz2IvTPhyfl6/c47lNUSyTNur6+0C5y7NJbY3M9o5BrYhaVZbbzQJrapxsFSc8kJttho2CCx/u6G0RVEgRIQiyVuwIkcZFKmcvAKG7Xr6ro6sfpyO5pNuHifAJRmI6xBkrPddec6UInQbRTDm6Px/ystYP7PfPMSeQXBSy7J5wIoxGGDAkCbK83qiM4QcNQzMAYNI+S+XjNQ6GWeW1wEr73jOn/KTikKC5FszxmKjaIQNsJlnmjpaKDc66VQGUBDgfNgaJYJc3lKFO80ShARaaApC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vlasbs5d4RQeNUHnwfXRpGXN4kd7vFesebyjTPhruL4nhqNyLPJqRRbW0IS4A7PxMV3kGu1bMVgSoc6n56Ge3T4Nc= 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: These two functions take array of pointer to struct page. Make them take array of pointer to zsdesc instead of page. Add silly type casting when calling them which. Casting will be removed in the next patch. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index dc6a7130cdfd..821d72ab888c 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -1361,7 +1361,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 zsdesc *zsdescs[2], int off, int size) { int sizes[2]; void *addr; @@ -1378,10 +1378,10 @@ static void *__zs_map_object(struct mapping_area *area, sizes[1] = size - sizes[0]; /* copy object to per-cpu buffer */ - addr = kmap_atomic(pages[0]); + addr = zsdesc_kmap_atomic(zsdescs[0]); memcpy(buf, addr + off, sizes[0]); kunmap_atomic(addr); - addr = kmap_atomic(pages[1]); + addr = zsdesc_kmap_atomic(zsdescs[1]); memcpy(buf + sizes[0], addr, sizes[1]); kunmap_atomic(addr); out: @@ -1389,7 +1389,7 @@ static void *__zs_map_object(struct mapping_area *area, } static void __zs_unmap_object(struct mapping_area *area, - struct page *pages[2], int off, int size) + struct zsdesc *zsdescs[2], int off, int size) { int sizes[2]; void *addr; @@ -1408,10 +1408,10 @@ static void __zs_unmap_object(struct mapping_area *area, sizes[1] = size - sizes[0]; /* copy per-cpu buffer to object */ - addr = kmap_atomic(pages[0]); + addr = zsdesc_kmap_atomic(zsdescs[0]); memcpy(addr + off, buf, sizes[0]); kunmap_atomic(addr); - addr = kmap_atomic(pages[1]); + addr = zsdesc_kmap_atomic(zsdescs[1]); memcpy(addr, buf + sizes[0], sizes[1]); kunmap_atomic(addr); @@ -1572,7 +1572,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 zsdesc **)pages, off, class->size); out: if (likely(!ZsHugePage(zspage))) ret += ZS_HANDLE_SIZE; @@ -1607,7 +1607,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 zsdesc **)pages, off, class->size); } local_unlock(&zs_map_area.lock);