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 C5E04C54798 for ; Wed, 28 Feb 2024 02:17:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 490F46B0279; Tue, 27 Feb 2024 21:17:21 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 43FD76B027A; Tue, 27 Feb 2024 21:17:21 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 307166B027B; Tue, 27 Feb 2024 21:17:21 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 221826B0279 for ; Tue, 27 Feb 2024 21:17:21 -0500 (EST) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B38BD160E4F for ; Wed, 28 Feb 2024 02:17:20 +0000 (UTC) X-FDA: 81839600640.09.C5AF8CF Received: from out-175.mta0.migadu.com (out-175.mta0.migadu.com [91.218.175.175]) by imf11.hostedemail.com (Postfix) with ESMTP id 9F7E540003 for ; Wed, 28 Feb 2024 02:17:18 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=THc50Ii4; spf=pass (imf11.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.175 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=1709086639; 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=ic7ZEF6fNvJnl0rUWJu3yuWTnO+lxbv0p/6gX1wuoYU=; b=fVFymXPKXFRMjzw3h2djJxgQOI007GdzPv8l6B8WaGkXEz2GQRSjQfA9Y40nU+Ddva/Kqt O8QSfF73kvE8KqJRgb18yWh1Bj4mbixYdMWILgd/OK7xQuPPntu2x40iIB0SM9TcFojKks 4hGABp8JAxuKwmPOcj/MCpo1Iz9G4gs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709086639; a=rsa-sha256; cv=none; b=cPtFFuGyVhz1y7aG36LsnLEiKNPr+GMe4rTYXbAGzXsHM93Oko7HukSTvMBVyqurHoHzUz lE/qa1wSj+FkD5BTofX+2TMgp9qJbQnKX+PcZ/B6pvJuTcGMDIqvB5jXsuTr0BV6HPEfm8 Cr04K2On5rsDpiZF37JaYcw+9akw8nc= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=THc50Ii4; spf=pass (imf11.hostedemail.com: domain of chengming.zhou@linux.dev designates 91.218.175.175 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=1709086636; 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=ic7ZEF6fNvJnl0rUWJu3yuWTnO+lxbv0p/6gX1wuoYU=; b=THc50Ii4eNRMF6sen2/5KpQKcrkkcQYGdj+Hu9Bce5nQaqb6q1FAFMpnifomS3ameWp9Y1 8F1nT93q66cmUZAeS6ApkNQdQwWXMgNBxIz3E7O3l6ELgMVxjU78QZWh/WtVeJ444izKcp KEnhQ81K2MVCipdddH6dpCZa9y2yRvM= Date: Wed, 28 Feb 2024 10:17:02 +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> <20240228015437.GB11972@google.com> X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Chengming Zhou In-Reply-To: <20240228015437.GB11972@google.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Migadu-Flow: FLOW_OUT X-Rspamd-Queue-Id: 9F7E540003 X-Rspam-User: X-Stat-Signature: ic65kt7m8f5d3r3b49qm55pk66phg386 X-Rspamd-Server: rspam03 X-HE-Tag: 1709086638-308260 X-HE-Meta: U2FsdGVkX1+Qul4xa2Kj81+pJVyEiEAs4UoTDWNNh1LXfCl8OIA2/3d5hc9f/ib8dG+ugn42m2UGdDZfp4d7Hqj6JhHe/aD2rh7CVNzo56ikZV60UzH7kg1r5Y2EPygOaAVBlr7Utwb2rKuXLJYCvShOSoBWbtdSV5nc6EXRsUtc3QWDxuF7n261eJGvcEv1x7gWGBsZ6MIA3aVNBY2lcfMVSWm8yd6VDmY2JZtxj8NN+DZoiV4IuEY3mo6nJTU85WfnnphGeFugD1VQlkhLXngEMDQseeIR5Pd1osQf6UZ50VlquJlmdvWYv+AMsvOrr/AnmckSHIdZ206DsSWnLReIuS80rStivg5cnUXhmVqcDt1VMNULgVF4gjKiOkUxSW68su1PEvVUITGgPC1TdpEO/h6XmETDKY02NVmBjCNSrU0UbaC2n27unjG8ev8IZO11e/sSSv0ozR5EJFRG3Y95YPVC04l+RI2xaOyVqTkwIwSjBDRsfY2zrU4kNhhN6zx2WYMTL4ei5etkGNKFANJUvuZeAOPlnJh0DT/WQF0S6KQsxSSNDwQKvqX4he9zM6pJc374gsTSA+CluLNPV0nLpN8lVHFUG288wRQ9N5AXgXImhlvoXoPKLbFDpm5wjzE4xz9KaO3T1WkYLQPQd62FqiMMRXafAdqbWIMhfNhD23ISN4HPQFpclXqd48NQt1fp+iOrerX9iduIN6w8Z+2lLVXX5Rmy1qGl0zgRvc9lj9M9pyLG/TED1AZDN0GiIvBnVykrM304vZnMxuipYORru8i/IT4a+vROwUf+xDfRAiz5fkCkseO0J5tWzhbLajycoQnZNPcv/7AOOI1h9fl/x1HE/KS1Fejmb8Vlw4MQOGMaJd61pGBRXDZ2NAfT2dPzPgV5L+1NsosdYv0W4xa6JdOZVM+jEcrJZkkRJtRh9RbTYwZGigMSxOM/lFVap0iO0byLa+Nh9/EsI0R u0JtmL9y XBcprp58k/fEv/XImSHfZ4vsgbVUkydvoVC33SfvtI2PoRnbZQqTIez2rqPbLLzEg6TQYaMTbgZv3PR4L0aHgA0uZTA== 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/28 09:54, Sergey Senozhatsky wrote: > On (24/02/27 16:16), Chengming Zhou wrote: >> 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). > > Correct. > >>> 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. > > Right, that's what I was talking about. > >>>> 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? > > Yes, thanks. I think separating handle and object header in the commit > message will be helpful. Right, I will improve the commit message and send v2. Thanks!