Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1779487rbb; Tue, 27 Feb 2024 00:16:36 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWKL5nP8PqCvUAWEqeFeZg8zXM7rSQmJGWGbXfp7SPy3zxAn54wVvSnywgxdVeNHquHKeLQb06i31IpJ7caE3Hb7uetJtUH+61ThOKiQQ== X-Google-Smtp-Source: AGHT+IGxFcJDj0bSYj0oSh6YVoqjEJ9EcqohuXThU+Z/pTYxpZXla4vIJZt7e+oSma15B2vxI1oZ X-Received: by 2002:ac8:578e:0:b0:42e:4f7e:5fb1 with SMTP id v14-20020ac8578e000000b0042e4f7e5fb1mr16438195qta.18.1709021796596; Tue, 27 Feb 2024 00:16:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709021796; cv=pass; d=google.com; s=arc-20160816; b=C4LW/wyquC2fjkXUOaz2E8iqQY2zmbMrRV6MyA8yadeIULN2lfCLBC7s91ZtzkjBkk Z09lFgwRKozm8mUKDmU42Ztc0/+EB8c10GIJvNcbgYy+BouasxJZvcGf9VMMtK4I5Mmk SsqkOpNSjMnWVbeT4+0Ah+jKs7uPrv6SMLAF/qzIxg1Gpg44RV7YGyv7DRr/tZNTOpos sS23nIEuAFlNacnpbODRTJBfk3uexwqhzodc7jrWFJRla6zQ+xyW7sRHVJ4RT/BhO+NP O1wL4UbOHMJm44zzGHZ2xIg4hiM5MjY8ngU5vZ4msln2fYNDi3jeqQHMz23vqdpxFh5D vN5Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:dkim-signature:message-id; bh=g0Qi3G51CgJBKU5e5sRVWIuufbNQP1OF50PFsE9woxw=; fh=+U4Dq2Fj9KLQ2K61QjuCgVUsFPjWTx61Ko/gWWNo8N8=; b=h+C/pf3ZLV0qa9eL4W480DEGd6gtsnpgdTJObu34bKLi7XQRDyKUkUQmE/lL8Et6df XzEUKe8TQkPTUaV0w57/OTlc91CsUq6DYw5b0gLNcFpcFv1ghkNIGFsSLL/AINcTMAY5 GylU2oDTbL7tr5EryN2aek3luoO3u/+eX9un9aBqtQPtDIzHMZegEQOiBkvZd82yG4T3 67CTpSNrDqGX//XBFN9/+tGdFmFGkV1fBl+mm9sL+mpuE8hel3Diyu2tKoERzQKwOnhN QfjdCUBbljMiNsLWXkt4sO7ZigZMzS8zwwsff88ZIghX4kVOBz/GAaq8/o/iJpNqk4hh p/Qg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="Ex9/7jSK"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-82855-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82855-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b8-20020ac84f08000000b0042e6da8dde9si6711622qte.358.2024.02.27.00.16.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 00:16:36 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82855-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="Ex9/7jSK"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-82855-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82855-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 55DDB1C21035 for ; Tue, 27 Feb 2024 08:16:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4688756460; Tue, 27 Feb 2024 08:16:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="Ex9/7jSK" Received: from out-177.mta0.migadu.com (out-177.mta0.migadu.com [91.218.175.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4584B52F62 for ; Tue, 27 Feb 2024 08:16:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.177 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709021790; cv=none; b=fsbPPLUGho2vDhSLGx8dsSlHJVc7qPNKZLzCtORGLcx3IGuN9JZv1BuQL4PoA1LEFNQqoAk++NTAqxe4/9RtDlOUsvq+XHV1rn7bfwKddFLt+63BJkFPK5hbqEtyeJVvGQzdQjITBOyEhonFsPvpzTHCnS9wa13aubHrFPxPdRM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709021790; c=relaxed/simple; bh=ogrQRebIGYX6RGNzEgtcWYlKlirZ+XllO53RH8xUWzc=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=rIdNgaqFZnRcvm/a/WNyIS+UuObgWcPgeLbx6SZ+CMne+bOP5GOiweabLFXNYcTiW/Cz489jPfzx/Q8sdfSG6hMttKr/IJjddM0AA0HpdoPIWW7ctKG9UDB/UnT9c0CdCyOQtIwGq7YjHUvQCs+MR1BgGV55xYLZaqWuvFMXPy0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=Ex9/7jSK; arc=none smtp.client-ip=91.218.175.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=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 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 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.