From patchwork Mon Dec 16 15:04:44 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: 13909891 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 38E8DE77180 for ; Mon, 16 Dec 2024 15:05:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 862056B00A7; Mon, 16 Dec 2024 10:05:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E8446B00A9; Mon, 16 Dec 2024 10:05:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5EE736B00AA; Mon, 16 Dec 2024 10:05:52 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 3A3806B00A7 for ; Mon, 16 Dec 2024 10:05:52 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id EAAF9810C4 for ; Mon, 16 Dec 2024 15:05:51 +0000 (UTC) X-FDA: 82901144844.20.6BAA955 Received: from mail-pf1-f181.google.com (mail-pf1-f181.google.com [209.85.210.181]) by imf27.hostedemail.com (Postfix) with ESMTP id 1BC5F40025 for ; Mon, 16 Dec 2024 15:05:16 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=VhyxqmAx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.181 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734361522; a=rsa-sha256; cv=none; b=Det1B/4XXTcIXngPNfIlX1nL3KXHlstvv3rUGrN8sdIYGJNAxj7jG2YZyzxBuxevPSGpig UHPovBFEreaRjiQevROHizhDTCxI94E/ER2geUZ+3BH7PT0Tl4ELvAbwZn3jhCA9N2gYLG gZA5g4KfNl4yW2gkWJk08sFhOYdSu0E= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=VhyxqmAx; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf27.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.181 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734361522; 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=JNNIvdO8t2iCYzARstvgeDaCH7MMZqqXTLJPJt73f0Y=; b=NgFyuSeoYRvWCfIjN98LBJfzqxWnIKLgc9uZXYlghJMGV+fDWsxlwqQBviIaUXCRYqDhaQ VF6Y+pdwBY9faCnv2rTwA8qFtNOirHPQIWV7L5NoUd6mFXZJGEGmw+Ol6HlAo6kufaeSpz erx90N8uuWKB5gT637Ofb0pED63nmyo= Received: by mail-pf1-f181.google.com with SMTP id d2e1a72fcca58-725ee6f56b4so3625804b3a.3 for ; Mon, 16 Dec 2024 07:05:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734361548; x=1734966348; 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=JNNIvdO8t2iCYzARstvgeDaCH7MMZqqXTLJPJt73f0Y=; b=VhyxqmAxImr1Z2eZ2riXBI0m/BCaULS9+rVdn7IFYNeoH8z5Tjp5Y+qPyFEjkx+j+t cf45V/2EEk+eDCqY9hMq4evE6iqijZ4IyWJ0M4k2+Z8B7DDzdKkNf3HxeCjTIRyBBOC+ IAHAkinOA06jdz2dyFiHHS1I1G4wF/bygxItJmBSjyOoHjpkCyTFh6iiL6eBzfckfZnL wNBDoUUpVyLy5lV8/xsUWn1T9tTD67FHjSEtHwtm3nnqXXY4g8VWlpCnQLym+6MoKSLf ce4AqzloV/6+97/ODRg77gaNZZ66sAQihFQjv1brLcw/g6xWbg5fITzK+EBzLYJrWeUU s7Hw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734361548; x=1734966348; 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=JNNIvdO8t2iCYzARstvgeDaCH7MMZqqXTLJPJt73f0Y=; b=nricnsXnkTb54ReAKSJOvJvWZvr0VF4ATYDfHNmm25OsqQOJXp/MFFqZFhk0onhDTA iPKXhJU7JVwwQH+Sld6z7l+wMM8XrHieMKdykTQG22We6RG1D+P6JHJpVjmpDndka1+H xJg2puvLCKl+Lo7e1XMaq95UD9Jsu3TZiN/SXqLgG2NCN7WCoJ48aTncHfxrlrZSDVCi gfkXnRpoug4EiFS7Vv4yA7ItmBHDfsWKsbNhtrNZB4GQTYOrUCV46UyB1iffy23kYidB pLXJDVegSNw/eG6T0P5iU0iM2dTwT8/H0QKLjG97tseBKSAYW4TU0ZUkBCFS1hlwAyKo CR/w== X-Forwarded-Encrypted: i=1; AJvYcCXYzBEpSRdwBLVsW3lHl+sPHuzfI33IGH0gimjXZF1hFbH/tPt+wSJk+bUNqBrH/MTwpBjsiiQerQ==@kvack.org X-Gm-Message-State: AOJu0Yw+Ftn90JKkenowsiCqXWkRmW3odmlfDrD+BjhH1Wdks0GPOVEf cTFPPeOoqxAYtWUFBoqdIa78yWgp9NDUsWoAlIpfNIlhS8CnDVo/ X-Gm-Gg: ASbGncv5OLtmbkSpmFFhB9dbzSMSoDM3LRwqy7wxAebAQVN9yHsoOQgcOXoe3z8hwlM yQsgWazGTKrTE7r5HnV82hM9uXEQLHP4e4jBCfnq6FMMkUxvTr3JuNAUNflwOHKcvoXCx3BgQdc W/KtxRrCCEFIzzKKbKupzYDA2DO6CQ5BUIJZk/IM+lzpe40EaA/gKt0Ck40ReU0egKHztYQY2vr DgDIOol/AJsFzIeHQRgkoR0+3g2bVS7OXsirrVIoOKpzG6SaKGcYVoMRH8AWzD1twk= X-Google-Smtp-Source: AGHT+IH/KuANWO3BzkrFDMIcWhBwQCJ8TBIe54LgFWjj16Zw4HErAncmOuOB/4voQ65mdsf3YT8XoQ== X-Received: by 2002:a05:6a00:1250:b0:729:49a:2db9 with SMTP id d2e1a72fcca58-7290c24ef90mr16798371b3a.21.1734361548386; Mon, 16 Dec 2024 07:05:48 -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.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 07:05:47 -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 13/18] mm/zsmalloc: convert location_to_obj() to take zpdesc Date: Tue, 17 Dec 2024 00:04:44 +0900 Message-ID: <20241216150450.1228021-14-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-Stat-Signature: c9a3n7h3qwq3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OjAwuc7UN2brlFz8vrbfxsuYXFls3NzP2s+E4cobfq8yQq0Wh0Y/7G29633LLrpizNIkalaNyx/4iIChCXXfM53/u2Gj/Gw43o4j5K80y/iL5PtzfI0XYH6daASsn3cEzu96Xh+Uz7yEo4wNWF4XhtzWom/Livuq3vVqLeuOSNARafW1uyuQqPBBSd8bBeaO9ddt9lBFVli8PzrWLKAt09U0hi/IDqSYORX7tjHdGhyNCitZBfSyiM3ppaiIbgAloIiIF/A7WMCu44Xp0yXlbfGjI5mOGyYcRRsgdCNzJIDpmJCc6Duw+mh+qYUZAQOfa7w0pKfDTK0UxsvVgXKELZuozqucjeG9DgqvPHkfgngXiKrKijiZeLaVYxr0oonCbHwLO+dYn4CxYVZWhtlff8M5Iep/z05bXr+TQvFPGwSdBN3ug7v3I10WHYMMqtRaFBV2q4kDAAbfquLMmds83xF30vaaxvaVz+Cq7E8FVCSk655zQkf7nXhqketuWUy07T45cpIBT/bzE2CgQgaMXF5pjC/3AGWDwW0ch36w92uF274= X-Bogosity: Unsure, tests=bogofilter, spamicity=0.471812, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: As all users of location_to_obj() now use zpdesc, convert location_to_obj() to take zpdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index e1f501d51226..37212964a365 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -804,15 +804,15 @@ static void obj_to_zpdesc(unsigned long obj, struct zpdesc **zpdesc) } /** - * location_to_obj - get obj value encoded from (, ) - * @page: page object resides in zspage + * location_to_obj - get obj value encoded from (, ) + * @zpdesc: zpdesc 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 zpdesc *zpdesc, unsigned int obj_idx) { unsigned long obj; - obj = page_to_pfn(page) << OBJ_INDEX_BITS; + obj = zpdesc_pfn(zpdesc) << OBJ_INDEX_BITS; obj |= obj_idx & OBJ_INDEX_MASK; return obj; @@ -1358,7 +1358,7 @@ static unsigned long obj_malloc(struct zs_pool *pool, kunmap_local(vaddr); mod_zspage_inuse(zspage, 1); - obj = location_to_obj(zpdesc_page(m_zpdesc), obj); + obj = location_to_obj(m_zpdesc, obj); record_obj(handle, obj); return obj; @@ -1845,8 +1845,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(zpdesc_page(newzpdesc), - obj_idx); + new_obj = (unsigned long)location_to_obj(newzpdesc, obj_idx); record_obj(handle, new_obj); } }