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 C2289ECAAD5 for ; Mon, 12 Sep 2022 14:37:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C24A56B0071; Mon, 12 Sep 2022 10:37:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id BD3886B0073; Mon, 12 Sep 2022 10:37:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A9BB58D0001; Mon, 12 Sep 2022 10:37:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 9B0B46B0071 for ; Mon, 12 Sep 2022 10:37:44 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 6C08C1203AA for ; Mon, 12 Sep 2022 14:37:44 +0000 (UTC) X-FDA: 79903687248.31.0927C2A Received: from mail-pl1-f177.google.com (mail-pl1-f177.google.com [209.85.214.177]) by imf14.hostedemail.com (Postfix) with ESMTP id 0B69F100099 for ; Mon, 12 Sep 2022 14:37:43 +0000 (UTC) Received: by mail-pl1-f177.google.com with SMTP id c2so8803440plo.3 for ; Mon, 12 Sep 2022 07:37:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date; bh=CpzuIbNJ8KEdKpTsfsFC0v9WS/vo0DOAwr19c0IuV2g=; b=QQX1+0QsF9vc8k2cmkn796NqgHxnh9hHihIS152Lauz4xX6Xafz/EBsmP3I9x7A1fx ijedjcuneCOvmAPPCZ0g5uMhdeCuqktQC1+2sZMYPdSSmIMoAdk5Pz5p+FJfYRKTy+sc JYI8zcXG23fEU4NP+CS3JwU5vFYBgLdjmnVy4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date; bh=CpzuIbNJ8KEdKpTsfsFC0v9WS/vo0DOAwr19c0IuV2g=; b=ABfPDOvhHX6Vf8O2oYhy5AW9h7JXhVju79MMxouiK4FtyH1DO1YqLWQpkyTOyFuFOZ Uk3dAk7vWwp24P8v9Gwrue6s1QP+TaO+KFlCzWNVK9GRZErVIIUMPMdJAHxKXpq5AOtr 4Cd6wtjsQGiy5DMKour/olf2oy5VGZHpMkzbwRPtJGsBkmTNPHGeh2JW9RQmHT/mEZVQ gUGT3NvYzPh9hCa/gM3QQLhysprZlw1ICurIG7N9j++dPArDWOXm58BpoqI8zMBzdpm0 5/m+FoyH4RnPr7ng4XifnQ9n//l4CISrwwEL/ULWiTf3jj7NMFl+JFzv6EeKvieYv6jZ pDcg== X-Gm-Message-State: ACgBeo3HCwe2baMXthP9AMHt5VSOJAheXdouz0WSHgbgTX/d1RYej7zR g10atC+XPNiPkS0E/1oYlbyn/A== X-Google-Smtp-Source: AA6agR7atuOV8oIRurU0P/NDqF37/hyYybcfK73M3+gwGcWvy8JmnFCJM3LHSVYHdWeUojbQtpIxeQ== X-Received: by 2002:a17:90a:fe90:b0:202:a345:b7a6 with SMTP id co16-20020a17090afe9000b00202a345b7a6mr6609263pjb.14.1662993462959; Mon, 12 Sep 2022 07:37:42 -0700 (PDT) Received: from google.com ([240f:75:7537:3187:481a:bead:f512:e554]) by smtp.gmail.com with ESMTPSA id h6-20020aa796c6000000b0053e22fc5b4fsm5631299pfq.0.2022.09.12.07.37.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 07:37:42 -0700 (PDT) Date: Mon, 12 Sep 2022 23:37:38 +0900 From: Sergey Senozhatsky To: Brian Geffon Cc: Sergey Senozhatsky , Minchan Kim , Andrew Morton , Nitin Gupta , LKML , linux-mm Subject: Re: [PATCH] zram: do not waste zram_table_entry flags bits Message-ID: References: <20220912053755.156704-1-senozhatsky@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1662993464; a=rsa-sha256; cv=none; b=3ehhiAvvAyXsHnz6QQ3Wt8PDtEMaFlpOz29J1VsD51dLfWhvuOyyAmeY3694V1hlC6GFVG CSpgSXT2T8lWFg9UFa/TCMIqn62LH3JlZ+MLpMFQ5R0zAdA8YA37CUL7j+FtP6vJReOsCs 0RH4mXDTGVTp1kRjV2h3f0UauelKUZM= ARC-Authentication-Results: i=1; imf14.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=QQX1+0Qs; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf14.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.177 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1662993464; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=CpzuIbNJ8KEdKpTsfsFC0v9WS/vo0DOAwr19c0IuV2g=; b=eh48YjV6U8SYeN+4JGC/rOe3Vj3+hXLoIntiAyR1GHJ8oJSBb1Fm0/rgL5zqQrpOzzRXBV GaXrGCqUSoU04rZg+PzhrD9JE4V1FwkszmPVQ8qTu7HXIDZtXQi0cAU9ON03Tsb7HUgQWC +4l5lH8qEpE2cbByiCX0bGeXXqQzIfE= X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 0B69F100099 X-Rspam-User: Authentication-Results: imf14.hostedemail.com; dkim=pass header.d=chromium.org header.s=google header.b=QQX1+0Qs; dmarc=pass (policy=none) header.from=chromium.org; spf=pass (imf14.hostedemail.com: domain of senozhatsky@chromium.org designates 209.85.214.177 as permitted sender) smtp.mailfrom=senozhatsky@chromium.org X-Stat-Signature: 8sxhoqr5roozebppx3t7114zpwkq46ui X-HE-Tag: 1662993463-39848 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: On (22/09/12 10:20), Brian Geffon wrote: > > /* > > - * The lower ZRAM_FLAG_SHIFT bits of table.flags is for > > - * object size (excluding header), the higher bits is for > > - * zram_pageflags. > > - * > > - * zram is mainly used for memory efficiency so we want to keep memory > > - * footprint small so we can squeeze size and flags into a field. > > + * ZRAM is mainly used for memory efficiency so we want to keep memory > > + * footprint small and thus squeeze size and flags into a flags member. > > * The lower ZRAM_FLAG_SHIFT bits is for object size (excluding header), > > - * the higher bits is for zram_pageflags. > > + * which cannot be larger than PAGE_SIZE (requiring PAGE_SHIFT bits), > > + * the higher bits are for zram_pageflags. > > */ > > -#define ZRAM_FLAG_SHIFT 24 > > +#define ZRAM_FLAG_SHIFT (PAGE_SHIFT + 1) > > Why not just hard code 16 with an explanation that it cannot be > increased further using the analysis you did in the other thread? It's > going to be tricky to reason about how many free flag bits actually > remain with PAGE_SHIFT across all architectures, especially given we > have no architecture specific flags. Well, zram should not make any assumptions on arch code. How do we know that PAGE_SHIFT 16 is the max value we will ever have? Some arch can come around someday and use PAGE_SHIFT say, 18, and we won't be aware of it (using hardcoded value of 16) until someone hits a really hard to debug problem in zram.