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 6B418EB64D8 for ; Tue, 20 Jun 2023 11:16:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E823B8D0003; Tue, 20 Jun 2023 07:16:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E0B518D0001; Tue, 20 Jun 2023 07:16:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CAB5E8D0003; Tue, 20 Jun 2023 07:16:49 -0400 (EDT) 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 BBBA78D0001 for ; Tue, 20 Jun 2023 07:16:49 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8DE0540A4C for ; Tue, 20 Jun 2023 11:16:49 +0000 (UTC) X-FDA: 80922873738.26.FD2608D Received: from mx.sberdevices.ru (mx.sberdevices.ru [45.89.227.171]) by imf17.hostedemail.com (Postfix) with ESMTP id 4054C4000D for ; Tue, 20 Jun 2023 11:16:44 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=sberdevices.ru header.s=mail header.b=sE2KBRRS; spf=pass (imf17.hostedemail.com: domain of AVRomanov@sberdevices.ru designates 45.89.227.171 as permitted sender) smtp.mailfrom=AVRomanov@sberdevices.ru; dmarc=pass (policy=quarantine) header.from=sberdevices.ru ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1687259807; 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=rRdH1qSvA4EXGN7LOvS9GhiA87cu+zd2tHJIWeuHKis=; b=SVJzYpVNrVY0+wrLJZFuMwCAjd4xFIOPLGjIX58qMkxIFaYWXKrigxkWkjg3yZWmaXyFG9 ZnxGw2OraDmtPASYbkmkcudbZVVAW/RPznyJukVR+T2PwckWkQgVOITH2OqhAyGLgYHP5g XsZVTiy47vYhY5YiPIGM+eebQtCQAoU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1687259807; a=rsa-sha256; cv=none; b=OiA7mkPmOaxZQ/pCXqvZr+90c2k6JVnHPecUnUZlwn7izTsJZeUofzb/qI1wf5OZedGZnc P8aBzYCymdolOEPwN1lIRjPnZCqT1y+ieZUgbYhJjgjqyuo6D3djxgSxCszOD1OqKKV+Lh P9rd7BOMZzdkkzFGexWs5dOZsiKCLs0= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=sberdevices.ru header.s=mail header.b=sE2KBRRS; spf=pass (imf17.hostedemail.com: domain of AVRomanov@sberdevices.ru designates 45.89.227.171 as permitted sender) smtp.mailfrom=AVRomanov@sberdevices.ru; dmarc=pass (policy=quarantine) header.from=sberdevices.ru Received: from s-lin-edge02.sberdevices.ru (localhost [127.0.0.1]) by mx.sberdevices.ru (Postfix) with ESMTP id 0FDDC5FD2F; Tue, 20 Jun 2023 14:16:43 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sberdevices.ru; s=mail; t=1687259803; bh=rRdH1qSvA4EXGN7LOvS9GhiA87cu+zd2tHJIWeuHKis=; h=From:To:Subject:Date:Message-ID:Content-Type:MIME-Version; b=sE2KBRRShZwiNerdcnUf9FxWsEgnXpVUg9GCUOkSmufXHNwEB06OHsXTLbcHn1o1+ qwWPnOYZtav1PRwYkFzXlCsMQPpiCO87+Eo+BWEdne+LHhL4tHIrAdeAaNYEmaBqpn R4Eo6etm9/gXpBtDuBv6Jwt0QRTHu/xoskAggFl8egxeqGKp4W0ZnrYhoCR8Ny02Tn U9AGWYtvTCLTiM7NGHPlhhlAYdhSabCDNhvu9gOjh2FtvKcsAL+Kz5dF585lCYw6wo djDqL0Mv9KHCQepX0GLy50ExlK6f7/Gbx4aNzQiGTZBT7hWO4OlYOjpXRdLz43jIJ4 FoAF3Sd0R1Tng== Received: from p-i-exch-sc-m01.sberdevices.ru (p-i-exch-sc-m01.sberdevices.ru [172.16.192.107]) by mx.sberdevices.ru (Postfix) with ESMTP; Tue, 20 Jun 2023 14:16:41 +0300 (MSK) From: Alexey Romanov To: Sergey Senozhatsky CC: "minchan@kernel.org" , "akpm@linux-foundation.org" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , kernel Subject: Re: [PATCH v1 1/2] zsmalloc: add allocated objects counter for subpage Thread-Topic: [PATCH v1 1/2] zsmalloc: add allocated objects counter for subpage Thread-Index: AQHZortECyHNmKOx4kiy6hdprH0m0a+TTmOAgAALNIA= Date: Tue, 20 Jun 2023 11:16:36 +0000 Message-ID: <20230620111635.gztldehfzvuzkdnj@cab-wsm-0029881> References: <20230619143506.45253-1-avromanov@sberdevices.ru> <20230619143506.45253-2-avromanov@sberdevices.ru> <20230620103629.GA42985@google.com> In-Reply-To: <20230620103629.GA42985@google.com> Accept-Language: ru-RU, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [172.16.18.92] Content-Type: text/plain; charset="us-ascii" Content-ID: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-KSMG-Rule-ID: 4 X-KSMG-Message-Action: clean X-KSMG-AntiSpam-Status: not scanned, disabled by settings X-KSMG-AntiSpam-Interceptor-Info: not scanned X-KSMG-AntiPhishing: not scanned, disabled by settings X-KSMG-AntiVirus: Kaspersky Secure Mail Gateway, version 1.1.2.30, bases: 2023/06/20 08:27:00 #21534026 X-KSMG-AntiVirus-Status: Clean, sk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Z3mpJBxRjKJLH/rKMH8nG p1sgDF0W c3zj7/H7ZgWu3LgoSrLWNHEXy8FrHaSde0XJARQV7rCzynAZn1cErH9gL0+Q0erfOAhPbstnbw8vy+anUQsI/rJHCHUQO2S4TIrCJOl/LT+6s8xEiO8dPSINuPcEL4CvbUDCLjkNiI0C8KUT9wQYdiEBKMyyqoKiGLsOYbgg/pX2/3VRt8Uut7AuYc9pzpZAaUIIyKEkhTzsIcTmzSt9NqGw9X51K7rixbAWrRITxM16gcFfTEbjE/CyRq7L6KoTOqaDVcgOwjb/TkXZJDlS1Txnv2utL5ofYjr9MWqRQueUNtZLJqQCOgAU1vqmOgLkZmCbV9kRjXqTUMGUT8k2m2oSXIA== 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: Hello Sergey! Thank you for feedback. On Tue, Jun 20, 2023 at 07:36:29PM +0900, Sergey Senozhatsky wrote: > On (23/06/19 17:35), Alexey Romanov wrote: > >=20 > > We use a variable of type unsigned int to store the offset > > of the first object at the subpage In turn, the offset cannot > > exceed the size of PAGE_SIZE, which is usually 4096. Thus, > > 12 bits are enough to store the offset. >=20 > [..] >=20 > > If the page size is 4Kb >=20 > It's certainly not a given. PAGE_SIZE is architecture specific. > PAGE_SIZE_16KB and PAGE_SIZE_64KB would be simple examples, but there > are, apparently, architectures that even can have PAGE_SIZE_256KB. Sure.=20 As far I understand at the moment the maximum size of the page (according to Kconfig info in linux sources) is 256Kb. In this case, we need maximum 18 bits for storing offset. And 2^18 / 32 =3D 8192 bytes (13 bits, I think u16 is OK for such purpose) for storing allocated objects counter.=20 If sizeof(unsigned int) >=3D 32 bits the this will be enough for us.=20 Of course, in rare cases this will not be the case. But it seems that zram and kernel already has similiar places. For example, if page size is 256 Kb and sizeof(unsigned int) =3D 16 bits (2 byte), zram will not wotk on such system, because we can't store offset. But such case is very rare, most systems have unsigned int over 32 bits.=20 Therefore, I think that my idea is still applicable, we just need to change the counter type. What do you think? --=20 Thank you, Alexey=