From mboxrd@z Thu Jan 1 00:00:00 1970 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 F27FFC54798 for ; Tue, 27 Feb 2024 08:16:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7AB78440203; Tue, 27 Feb 2024 03:16:30 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 75B094401FB; Tue, 27 Feb 2024 03:16:30 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 622BE440203; Tue, 27 Feb 2024 03:16:30 -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 505AA4401FB for ; Tue, 27 Feb 2024 03:16:30 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 1A9F280B68 for ; Tue, 27 Feb 2024 08:16:30 +0000 (UTC) X-FDA: 81836876940.12.35865D7 Received: from out-180.mta0.migadu.com (out-180.mta0.migadu.com [91.218.175.180]) by imf16.hostedemail.com (Postfix) with ESMTP id 38AE5180013 for ; Tue, 27 Feb 2024 08:16:27 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="Ex9/7jSK"; spf=pass (imf16.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.180 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709021788; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=g0Qi3G51CgJBKU5e5sRVWIuufbNQP1OF50PFsE9woxw=; b=E1n8FZlkZ38THZQclBCIblHuB9Vux3/YkDAI3UCodSf9nI7S/k4pMEDPoexk4NLVbYe8OT a2QDWH9e7lO8K3KYz9ae5VHhUJPM24R8pIvPEbn2Bsiis6we7Tthq9YF4IjqBunvhcBFrM eBlsel5s2BDjSxKSUAlFpRxocDGkPAo= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709021788; a=rsa-sha256; cv=none; b=butAO5i4XcU9n8G7LJs/3v+uM/eLJ8HK1hZCssZJuOhXWJLip2jSyp9Vm2URsdwnc0s854 1hCZ1LnMpk2HmUybfkuLmI709KliWnfas8LSiwaSddj5ZqeyuPVCcRcaQs1F9oZuziB9+L Kq+2adf89b6DH763f1wJD7vKdft09Jw= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b="Ex9/7jSK"; spf=pass (imf16.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.180 as permitted sender) smtp.mailfrom=chengming.zhou@linux.dev; dmarc=pass (policy=none) header.from=linux.dev Message-ID: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1709021786; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=g0Qi3G51CgJBKU5e5sRVWIuufbNQP1OF50PFsE9woxw=; b=Ex9/7jSKMxy7nBQFw++kFPkmcK3l5ScRjxGXhwzuTs8xJyY4+njmycdqyw6GvkiJuWjsi5 y5SUGTA4r3NQheZPVx0Mj301JDa+Y/Z2Of/iw3XToN4l0B78UT8tSPGkBE87HKlPTsWTDq sZAejXynFE7uFoLwqybHWS37RR2EHCA= Date: Tue, 27 Feb 2024 16:16:17 +0800 MIME-Version: 1.0 Subject: Re: [PATCH] mm/zsmalloc: don't need to save tag bit in handle Content-Language: en-US To: Sergey Senozhatsky Cc: minchan@kernel.org, akpm@linux-foundation.org, hannes@cmpxchg.org, nphamcs@gmail.com, yosryahmed@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Chengming Zhou References: <20240227030045.3443702-1-chengming.zhou@linux.dev> <20240227075209.GA11972@google.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <20240227075209.GA11972@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 38AE5180013 X-Rspam-User: X-Stat-Signature: 4egbs7zz5nxhge7g7tupb7qucaim5rbq X-Rspamd-Server: rspam03 X-HE-Tag: 1709021787-90946 X-HE-Meta: U2FsdGVkX1+n8Vnpa22A7viqUYHXQV8NdtrrsYak5mov0zMGm6tt9jgeXC4UJ5cKjJebpZv8F3ObPCxULeEVq+IoB8Heruvj37KivbxpxP/4IdZE5A8w2xLTKJElxX06BKK9ZEVt2ANZyFgjoTWsQ1rAaVns36P5s3yuWYVdWu+m6juxQBMSFPCL78jY4JCmbD4uVz+DQ11kbYP98llBAxMHVqOkDN9fsQPi9bDWkfBw7SXQNMt/ocbei0wYL+pyCakGzZJkaVAOi9PIxvPBbmzjK4TpnlYzXHxbv39ioV9hhfgMrCq0hczNBVrmVzMS75nW8B4Ox/NDPRPzQn0W45Q5SCOcRj4U3vbU/38U8OGKuFrpdxgw/m/aKsNYfrje1TKlRJXvKpngsvmcu6RjdPYTbrAg15IjdgAST07E7n59nnR8tq06UobCKPS6IF0nQuu1JE71gv6r2XVUY4tCAYqOA/VCzkHMAvju3oWcZnujijQQDAhIIlfCdsrBB2U61ob8d+pxhOpazL7chk0U47TrYP4bPXdnPfo4Of3zTjVBEQbqBjrsPuH0TbkaBmZ+rgL48xUBUYvwk473qG5BvfH9kgy2T0XKX3jnOWMJwfSFTgHzTu1Z0Fpuu6JMhIUA2N0HLr6j/ZVRtQyaluV+hpPw7pq91JjbjeYE434Yo/47Zw2ddcfOf8mTFMW2lea3JVhk/B+ZoM48N8VWzOEDQfL3/4IUK9FxEJ8JZyf9BGSerMavKohdQUGVh31OO7CGZWwvwRUM6mfLiN0szpPrMarod+NH6EZsKJzadKjwsyc= 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: List-Subscribe: List-Unsubscribe: On 2024/2/27 15:52, Sergey Senozhatsky wrote: > On (24/02/27 03:00), chengming.zhou@linux.dev wrote: >> >> We only need to save the position (pfn + obj_idx) in the handle, don't >> need to save tag bit in handle. So one more bit can be used as obj_idx. > > [..] > >> mm/zsmalloc: don't need to save tag bit in handle > > Does this mean "don't need to reserve LSB for tag"? The head of object still need to reverve LSB, to save (handle | OBJ_ALLOCATED_TAG), only the handle doesn't need to reserve LSB, which save (pfn | obj_idx). > We still save allocated tag in the handle, that's what > > handle |= OBJ_ALLOCATED_TAG; Yes, this result will be saved in the head of each allocated object. > > does. > >> Actually, the tag bit is only useful in zspage's memory space, to tell >> if an object is allocated or not. > > I'm not completely sure if I follow this sentence. What I mean is that only the head of each allocated object need to reverve LSB, which is used to check if allocated or not. handle address -> handle (pfn + obj_idx) -> object: (handle | tag), real_object start I'm not sure if this makes it clearer? Thanks.