From patchwork Thu Jul 13 04:20:31 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: 13311280 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 D1408C001B0 for ; Thu, 13 Jul 2023 04:21:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 68E668E000B; Thu, 13 Jul 2023 00:21:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5C7B68E0001; Thu, 13 Jul 2023 00:21:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4434C8E000B; Thu, 13 Jul 2023 00:21:43 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 30BBB8E0001 for ; Thu, 13 Jul 2023 00:21:43 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 0EBB01C7340 for ; Thu, 13 Jul 2023 04:21:43 +0000 (UTC) X-FDA: 81005290086.23.B8F2F40 Received: from mail-oo1-f52.google.com (mail-oo1-f52.google.com [209.85.161.52]) by imf28.hostedemail.com (Postfix) with ESMTP id 4846CC0017 for ; Thu, 13 Jul 2023 04:21:41 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=X3NbDx3D; spf=pass (imf28.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.161.52 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=1689222101; 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=3gkqWMyo7b2B7ewPiOnxxOYIhM7JQ5HFP6zR7XlZTck=; b=hpOu5V5HkT/LN4PQ8ujmMIiqqoSJJEgl91KnLHFN6JzccOLcxgI75eXeZ1AynLPAGBOfDi 8kIOFHIBBjVeL2cvQ4x88znqyNFJpnekp3lks3OGLiYE01S9fL9lqBuZNqprwKIfVZjGYw RCjK9h8XymoWyh48TmpcMW1yVz5zR1g= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1689222101; a=rsa-sha256; cv=none; b=nUaWXtFG8dZ1vrs/EM5B93hci5k39XTUBXT24NREXSC3Z+zthiXLd5k0K88HuuEdUXyBMH GeUGr/0x/Zcc5dzUC/Dvcdczcpci5fjlM3FoPxIv/RaAxLxoIIqzV/A8mL4Mq25IN8r04b NDIiijxQgmnYkUA4BbYmYN6rYw76ESI= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=gmail.com header.s=20221208 header.b=X3NbDx3D; spf=pass (imf28.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.161.52 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-oo1-f52.google.com with SMTP id 006d021491bc7-56597d949b1so294903eaf.1 for ; Wed, 12 Jul 2023 21:21:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689222100; x=1691814100; 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=3gkqWMyo7b2B7ewPiOnxxOYIhM7JQ5HFP6zR7XlZTck=; b=X3NbDx3D8zqD9lwl2kii6f0ZcuwskOzE291MA+sqwvMG8ec0/+DCydE9arTynZ/hFV llNcsSyZINjLssmVLJhR57Gb9x7UOqBRh1WCnSKjNaGY/3+T1C4weTBTwLITapuddIWQ w/vZUGgdpa57Dotq9AB4QF2tiXUq+VjAJfzEOkNe8FxdJPM0yHkxP/8v9NSltQj6Uzgk Y0zydf1delIbaOOERiR33rUXICwirbWlvPSRGV3fxy8pYZuod/K46pv+voF0EYvcEB2J DFyIOGSSKXOkWmUQq5m3V5W1DxAHFb/KZdTzT/6VfC8EOkBljvhCX7zIpQF60wEnzop7 UlaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689222100; x=1691814100; 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=3gkqWMyo7b2B7ewPiOnxxOYIhM7JQ5HFP6zR7XlZTck=; b=SrX4/PvhulMRwEne9ACsXLCnMtNq1rnb4fprxjCznq89ZF/5QEvezxna5wvUOSBCHO kPFbtwiAaWjDQ0Yf1kiPDNDnqd2ASz4acZtEpxXhfLuIOnxNfX0q7y22mPsZy+x1Yhks pP6T0bBTn8qXc9b2LmQ3ICTv2xBuLTP8tCkIrftYbgAe6M8/CJGOiCri0kZ7Y90uLZIc zIAxSwhKeOo/u73h8FBVvouLQ57OQy6vyxR4Epv9pAQBzU3sxi8IfFUa6IozSiccGgIc C+jE5mNEOc9snfIBEz8ViWsTwUNDs96VF0wx+1xGRPNylThLt3QQhsIe8JGP7ua2rFRX 33iQ== X-Gm-Message-State: ABy/qLbJSr7/U8HruhWWXfov2k9oB/xNa7yoKXq8Z1ahUQojRB3cV0/U zF/j7kAZdlhKVD64G62cVVo= X-Google-Smtp-Source: APBJJlGiX7tftXPlnlj0r6WSZjzexhUUuLF83JtQLTrkv37u7pJOZ2k5ZiTxPcckOR51/J4NcCaw/A== X-Received: by 2002:a05:6808:1719:b0:3a3:bf6a:ba55 with SMTP id bc25-20020a056808171900b003a3bf6aba55mr682088oib.3.1689222100219; Wed, 12 Jul 2023 21:21:40 -0700 (PDT) Received: from fedora.. ([1.245.179.104]) by smtp.gmail.com with ESMTPSA id u18-20020aa78392000000b006827c26f147sm4346601pfm.138.2023.07.12.21.21.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jul 2023 21:21:39 -0700 (PDT) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Minchan Kim , Sergey Senozhatsky Cc: Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Mike Rapoport , Hyeonggon Yoo <42.hyeyoo@gmail.com> Subject: [RFC PATCH v2 16/21] mm/zsmalloc: convert location_to_obj() to use zsdesc Date: Thu, 13 Jul 2023 13:20:31 +0900 Message-ID: <20230713042037.980211-17-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230713042037.980211-1-42.hyeyoo@gmail.com> References: <20230713042037.980211-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Stat-Signature: 1gmo8fmy3crkao9sue3dfggaxm4mzr3t X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 4846CC0017 X-Rspam-User: X-HE-Tag: 1689222101-730730 X-HE-Meta: U2FsdGVkX1/PFx75lN0QCegANrOYwPsl+7VVUX59DJOdRAhZpyQlreN81GtsL4y0Lv7+aVaOruu51IhX99i35eHWGeGV+9lnhCQB5vwkCCCaXJzVfd5udyuIUaXBhFjmKC3TMXrWH2sZPS8B3hzDjojpO/vFajBSiHLFl4invaXFjyMyHEFlyk3558bR1iEbeYIRykTMM1Y1S5aqeiImX4keig3L1X+iweMAJJcfnT+LWGN/bM5gLccoATWmo2T1Fntdb1P0dC2fimWCg5eOyYByWk7tl97VHl8c3JQsjGJlm9fucV9u0jgwxHawIRhaSFNnI2sHwZW3Kt5SJr/E7gSDsYv1S5Dcyr4WysZ9CYa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zb7Feeuw68YF/q1Ug5GyQh7UjsEGNm2AHFaEfwACFM7/OhutUfxN1aGw1oQBl92lwR3Or7ufaIMSs3kZu0F0mvQXtYVQbHxxz8NwIKLeQZHsJnxt6Cz9E3jILi87jhQV2tLy1cqWA6J9oF4uDronQA== 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: As all users of location_to_obj() now use zsdesc, convert location_to_obj() to use zsdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> --- mm/zsmalloc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 69bd497de35e..fd920b659b1d 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -948,15 +948,15 @@ static void obj_to_zsdesc(unsigned long obj, struct zsdesc **zsdesc) } /** - * location_to_obj - get obj value encoded from (, ) - * @page: page object resides in zspage + * location_to_obj - get obj value encoded from (, ) + * @zsdesc object resides in zspage * @obj_idx: object index */ -static unsigned long location_to_obj(struct page *page, unsigned int obj_idx) +static unsigned long location_to_obj(struct zsdesc *zsdesc, unsigned int obj_idx) { unsigned long obj; - obj = page_to_pfn(page) << OBJ_INDEX_BITS; + obj = zsdesc_pfn(zsdesc) << OBJ_INDEX_BITS; obj |= obj_idx & OBJ_INDEX_MASK; obj <<= OBJ_TAG_BITS; @@ -1505,7 +1505,7 @@ static unsigned long obj_malloc(struct zs_pool *pool, kunmap_atomic(vaddr); mod_zspage_inuse(zspage, 1); - obj = location_to_obj(zsdesc_page(m_zsdesc), obj); + obj = location_to_obj(m_zsdesc, obj); return obj; } @@ -2014,7 +2014,7 @@ static int zs_page_migrate(struct page *newpage, struct page *page, old_obj = handle_to_obj(handle); obj_to_location(old_obj, &dummy, &obj_idx); - new_obj = (unsigned long)location_to_obj(zsdesc_page(new_zsdesc), + new_obj = (unsigned long)location_to_obj(new_zsdesc, obj_idx); record_obj(handle, new_obj); }