From patchwork Mon Dec 16 15:04:40 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: 13909887 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 C527DE77180 for ; Mon, 16 Dec 2024 15:05:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3313C6B00A3; Mon, 16 Dec 2024 10:05:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B9B46B00A2; Mon, 16 Dec 2024 10:05:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 096106B00A3; Mon, 16 Dec 2024 10:05:40 -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 D3DA06B00A1 for ; Mon, 16 Dec 2024 10:05:39 -0500 (EST) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 6EAB31A10A1 for ; Mon, 16 Dec 2024 15:05:39 +0000 (UTC) X-FDA: 82901145180.27.5641297 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by imf19.hostedemail.com (Postfix) with ESMTP id 7CCE41A001B for ; Mon, 16 Dec 2024 15:05:06 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=VcMMBjAO; spf=pass (imf19.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.177 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=V795zn61RwP0oNq6Uk6kYy1iA7djNdknGUFc8lO4Kr4=; b=W0GFrd3E2oF4/16qpt8uHdp+576jPeP4Yvsxeut8jPYEQvk3mlanjgfXBOOPiS79Wb4HgF e6HLlxuT/RaaP7jxh+92t6cE89p7n1A105I/SLdGGgps5ytFMpEzpDrD6DMR7WOZuHOjpP PgY7CnFGW/kbRZcD9IkBh2EZvVvGFLs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734361505; a=rsa-sha256; cv=none; b=L7tUBLuINfvL7J5U9fbAriM9kclYeu89gnTNXG25fauAxYdEl7nRHQGETZ8el++muflaGV y8Uzs2WUbx6KT1Vm52HOVGNuNCnrpOc7F5DcABHCjJJLoZWaAmj7Bu6BBn/LhOeN6klhUo Mw84SzbVpPcAUhoHQgw4kbLoEpuAlxs= ARC-Authentication-Results: i=1; imf19.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=VcMMBjAO; spf=pass (imf19.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.177 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-72739105e02so4580130b3a.0 for ; Mon, 16 Dec 2024 07:05:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734361536; x=1734966336; 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=V795zn61RwP0oNq6Uk6kYy1iA7djNdknGUFc8lO4Kr4=; b=VcMMBjAOTcZ+x82xxjkq2UzQhCf2L06Ucjg8M5JqrvxQWvZA3kumXcyY3KGN61sNXF sMGz0KOM5EIj51c6SgGdkU55UWFY2LJgu433aaj1YP89stZVRaNjwuNFcp6IKcd0ODFk cr8AI/B2HiRP0B8MjLV25sVg+63sBSKKZmqFdJLb/cUCn+VG5Z0XLofqA2YW3O0zDKLv Km9C7hHzPeYLcE7cm+m1FgvFx7MVvXY7oVM6pAHFg+Dxh6KmQVD5Oi9hCUU1ehNg18jy uWhPtkmaODeS/wML+R+lGyxrklbQ3Yha6p44dX0iuQrf1pm3S74/b7ldZb9J3sVfsGDf IGsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734361536; x=1734966336; 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=V795zn61RwP0oNq6Uk6kYy1iA7djNdknGUFc8lO4Kr4=; b=aa4fPSDlNKKpqvtZcangjdkXo/egkGiVoxuOilAjRwKrh6sZfHF2lbRKP163HMcsXd L6PWEqinrRt1jnr1pvQ36DrtZIn8WhLjl7gGRi1vc7Yzw1nWZlbAatuYHHxWTPtZMrYj OLdqEhdF4psBqYr7BC1M/FCQhbjvnw6OLh646FhrieuWM9BPHzvXCFU33AzNmhrDYavZ e8Lm/9fexeIz6OLahtk0zNzv2DJcgPsTb5Ri8bDwt5lX7EAN7r0JrTm0/PljWZ5rmfXK pnBSbaC8nBB7/xrD1C+l7F3duVzXrBeYVWddaaHvUrROgZ7O8tkK02QqSHtm/scLQ8vO 1XWQ== X-Forwarded-Encrypted: i=1; AJvYcCUSFpbWKznUXeb0HVIdqvHkNMw1INq7i9CUI6LiJxKXDTQSD8zX+qRrcFjg0AT4BU95TRksYzjWDw==@kvack.org X-Gm-Message-State: AOJu0YzkmW4C4RddXsgI069REAnwwBQyxjQe8XsSbt8dkj/MwFUHzOz1 mQYmAoe0LNKYgr1UugB9/4aR7mahITZnEy9keCORJyiwkj8JPlr6 X-Gm-Gg: ASbGncuAKxJN/N+qDdxDx4YO/eVrT83uDhxe8bS9R9Gx1bQ/66mFtt/49BYG+iA0iU6 JQFaoYrbTJNPLxsuXsUbz3pFCaFhF61n4MYztpqfoeAtbvYUwrT8TULTP5pn/T2ng5kCfmTOa5P tNm/07R0BRAGOCdBhaXL2J2ZvfHrMZ0XB0f6ncToZABMCswnxa3A+5D3M4SzL9K5oNV3E80B3pz IJUNjRDj33WquKJ9mOA4ewgZu0PO3372mUOBjdWa6ylJ9g7U06lAnmHtiNkfxlBeyA= X-Google-Smtp-Source: AGHT+IGnjmghU8VnzbX3ZJIL1K8vkccFxoqZLEV1ZhzLo2IiM1+EpkrCQkHcvru1dVMwLWl020wXzw== X-Received: by 2002:a05:6a00:ac02:b0:725:ebab:bb32 with SMTP id d2e1a72fcca58-7290c27c888mr18804743b3a.26.1734361536068; Mon, 16 Dec 2024 07:05:36 -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.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Dec 2024 07:05:35 -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 09/18] mm/zsmalloc: convert obj_to_page() and zs_free() to use zpdesc Date: Tue, 17 Dec 2024 00:04:40 +0900 Message-ID: <20241216150450.1228021-10-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: 7CCE41A001B X-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ug4eQzxPHw1nYQEeNgz2FQMJFA/XB6BShgVBsPaFFsNKeo8yHi0CHbxKmnbCno5jyf7ypipNB6V/XtkvZdtZWmz3xYbFA0L7HDw95Pl1Rcuc4AS5MK3CHm/XB3V6RW9k2vwtxvgBZPHA4uZw9/XORIcE5sD7MS7Q0RN5e+7gHGICp5nKnIzMXU4A0VQXamhvdoKNUg9IwEbXQCL8YzJSI/e1Lh2TCbPr5CXz3mc3FKdeGqbhWTOi2qeJ/KI0GgOyh3JYDWGLoe8LxoZ1VsfX8hd18DunZjiCYSkvESZHiqrzQODrWvs0xo6ciuXjVmaPut1ki6yuUQaYN80KK299rT8y6chxv2A3rLBcSLpL4otOzvB7JbrivKORoC1iGeXMjZRRZxztQKx2foWBMNFav2hIubmDC+Q78goi6Wp6WMVNwamITHEFRxvJQLl3eSIDn8vuzdSxc3pWI5VWpqVTZrR5sCBH4LgsR2g9Lh75bWFMTotIAbCiQtnVaZJEnu6GuIMl9O7teNcJY2SUELdjS6VMcNDLxrfhTk8pEBhMSeJ61A= X-Bogosity: Ham, tests=bogofilter, spamicity=0.445202, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Rename obj_to_page() to obj_to_zpdesc() and also convert it and its user zs_free() to use zpdesc. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Signed-off-by: Alex Shi --- mm/zsmalloc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c index 83d48cffe96f..112603f9449f 100644 --- a/mm/zsmalloc.c +++ b/mm/zsmalloc.c @@ -798,9 +798,9 @@ static void obj_to_location(unsigned long obj, struct zpdesc **zpdesc, *obj_idx = (obj & OBJ_INDEX_MASK); } -static void obj_to_page(unsigned long obj, struct page **page) +static void obj_to_zpdesc(unsigned long obj, struct zpdesc **zpdesc) { - *page = pfn_to_page(obj >> OBJ_INDEX_BITS); + *zpdesc = pfn_zpdesc(obj >> OBJ_INDEX_BITS); } /** @@ -1462,7 +1462,7 @@ static void obj_free(int class_size, unsigned long obj) void zs_free(struct zs_pool *pool, unsigned long handle) { struct zspage *zspage; - struct page *f_page; + struct zpdesc *f_zpdesc; unsigned long obj; struct size_class *class; int fullness; @@ -1476,8 +1476,8 @@ void zs_free(struct zs_pool *pool, unsigned long handle) */ read_lock(&pool->migrate_lock); obj = handle_to_obj(handle); - obj_to_page(obj, &f_page); - zspage = get_zspage(f_page); + obj_to_zpdesc(obj, &f_zpdesc); + zspage = get_zspage(zpdesc_page(f_zpdesc)); class = zspage_class(pool, zspage); spin_lock(&class->lock); read_unlock(&pool->migrate_lock);