Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp9223612rwp; Thu, 20 Jul 2023 01:12:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlFNT5sDZ4oh3ywNbuo4qXKmQbg18sR/OBwuAQnnG3XLfrOg7FihWX+mCxgy1RP1R4exieIM X-Received: by 2002:a05:6a20:7349:b0:124:eea9:6691 with SMTP id v9-20020a056a20734900b00124eea96691mr5619763pzc.31.1689840747625; Thu, 20 Jul 2023 01:12:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689840747; cv=none; d=google.com; s=arc-20160816; b=U+wv/y1Iz3QWLb0ofBVVuLueBycEZv3dLEyj8wWQRiStLTjYfwWPph1l7kRa4SYfAN r5vfliXmMPDToy0g12JPK94bIMGOsqhqtkLcb1zQQyZtBKGf0UAkNX905wkVnBU54nSU 677CObPFqgh1qu1tynF0Lx9pFHSEkV6N9EaMsi8EXEJ80bz15/Zzjd9S1boUPhd9K8+m RyDQAum0uaPagRgfpDSqEF459tT9iVPWoYmI+B6PLOsKU8wGM/BZmub5qRd7OgRLnLlO qN/rD1evBWnJXg33uElHO1Yc6U2/WZCVFyqqqypiggpQCwotaTvM4yRpSgt4v/1zB7ox 8GMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=x57XYhU3kN/IVUYoEulD/81klEAIktkHi596Zb0HL4w=; fh=kRBOp9ZriQF/6IU7VbJIDpGqIEoE6NWGYC71EsOf1Mw=; b=Q/aWricjpDDtnLCQo2OrUf9ohZQKH2IKqErU/SipQbzzNTyPp1njAiL/xZFFqnyct/ Ph+nZRThNyiyniQyxwNot7BZQCN+mUXfGahInebcNPUA8+l1lJ+oX2Wvs7q8vwa3xycc ZmQ6I0n6zgNiV1RqLZmGcvhGIZNopeVfx1G8YhR4ferF3vFparsfpuo4QpO0Rxrfeizo MZb9eRWyw12BPldC8C76P3ZECgXjSd1YTiOK+KKfBhk18rwE2XKHhfovbFEcJlZA5MDp q7dNLU9zO0oZZFBoZ6tdiJQC4ihzHc+W6Z0z3u5EHzPXqbaSamLxHPJtqEhToE9qbJiM bjHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Dp+qHW/n"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i73-20020a639d4c000000b0050bd71e8618si293138pgd.848.2023.07.20.01.12.14; Thu, 20 Jul 2023 01:12:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="Dp+qHW/n"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231705AbjGTHrg (ORCPT + 99 others); Thu, 20 Jul 2023 03:47:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229451AbjGTHrf (ORCPT ); Thu, 20 Jul 2023 03:47:35 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B3552122 for ; Thu, 20 Jul 2023 00:47:32 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id d2e1a72fcca58-668711086f4so358053b3a.1 for ; Thu, 20 Jul 2023 00:47:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689839251; x=1690444051; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=x57XYhU3kN/IVUYoEulD/81klEAIktkHi596Zb0HL4w=; b=Dp+qHW/nR6UCyhAZiGmDV/jQFfcnch4ZFcmudCUX1GQQipGCSa3yHQRF9+bDdLBOpR lnGq/jOwqQ5etszI0WueigyK937e3TjBX+9CNEMs/ffg5YH463p4JtnpJwEATwVAtxOz 4ZhiSFw3R3//gXJvwcYzHrjiU4ntZVia03/nY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689839251; x=1690444051; 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 :message-id:reply-to; bh=x57XYhU3kN/IVUYoEulD/81klEAIktkHi596Zb0HL4w=; b=US1UWcc7CDeE0pc/uc0acbEXSK33WbjRjUHjVTtHvpxb/g3pv2Jd6uQcPj4KKK7uaD RR54WlHYpH43YblTjN4hO4fzPqUC2luVVm+Kf4TMaFlxzZdBYj1wEkVICGAx6kMUaYqD vYpyIHV5rYc3f+RBuAGZ7CR3JwFG/aEZemyhBCCj4N3/zINQI/EApfjgpBKzdjEw8C8r Eke73gOVoC37z3aqexgjoGh0xVHLeWvMooqulGQ9WAx9qY5I8CYzE47zcBBCVXSFrQHB jfclWE0guTREUpfGKZ5JEnI3f0MO6yva4Ek1Jnw7UI+WKZCXR0wX5M4k2XISj/a4GA08 EMhA== X-Gm-Message-State: ABy/qLb2Wf/Oy1YCIZc9BFPk+zB3eFFUpxLHOrNwkiHr1iXFvDiZwE7k dhuRwNDX9Mb3WkW2CsQWz0EAhA== X-Received: by 2002:a05:6a20:3943:b0:12f:d350:8a12 with SMTP id r3-20020a056a20394300b0012fd3508a12mr6583141pzg.21.1689839251288; Thu, 20 Jul 2023 00:47:31 -0700 (PDT) Received: from google.com ([2401:fa00:8f:203:648f:4ec7:23d9:d855]) by smtp.gmail.com with ESMTPSA id n5-20020a62e505000000b0065da94fe921sm511229pff.50.2023.07.20.00.47.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 20 Jul 2023 00:47:30 -0700 (PDT) Date: Thu, 20 Jul 2023 16:47:26 +0900 From: Sergey Senozhatsky To: Hyeonggon Yoo <42.hyeyoo@gmail.com> Cc: Minchan Kim , Sergey Senozhatsky , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Mike Rapoport Subject: Re: [RFC PATCH v2 01/21] mm/zsmalloc: create new struct zsdesc Message-ID: <20230720074726.GF955071@google.com> References: <20230713042037.980211-1-42.hyeyoo@gmail.com> <20230713042037.980211-2-42.hyeyoo@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230713042037.980211-2-42.hyeyoo@gmail.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FSL_HELO_FAKE, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (23/07/13 13:20), Hyeonggon Yoo wrote: > /* > @@ -264,6 +247,52 @@ struct mapping_area { > enum zs_mapmode vm_mm; /* mapping mode */ > }; > struct zspage already has a zsdesc member at this point, so I'd prefer to move struct zsdesc definition before struct zspage. > +/* > + * struct zsdesc - memory descriptor for zsmalloc memory > + * > + * This struct overlays struct page for now. Do not modify without a > + * good understanding of the issues. > + * > + * Usage of struct page flags on zsdesc: > + * PG_private: identifies the first component zsdesc > + */ > +struct zsdesc { > + unsigned long flags; > + > + /* > + * Although not used by zsmalloc, this field is used by non-LRU page migration > + * code. Leave it unused. > + */ > + struct list_head lru; > + > + /* Always points to zsmalloc_mops with PAGE_MAPPING_MOVABLE set */ > + struct movable_operations *mops; > + > + union { > + /* linked list of all zsdescs in a zspage */ > + struct zsdesc *next; > + /* for huge zspages */ > + unsigned long handle; > + }; > + struct zspage *zspage; > + unsigned int first_obj_offset; > + unsigned int _refcount; > +}; > + > +#define ZSDESC_MATCH(pg, zs) \ > + static_assert(offsetof(struct page, pg) == offsetof(struct zsdesc, zs)) > + > +ZSDESC_MATCH(flags, flags); > +ZSDESC_MATCH(lru, lru); > +ZSDESC_MATCH(mapping, mops); > +ZSDESC_MATCH(index, next); > +ZSDESC_MATCH(index, handle); > +ZSDESC_MATCH(private, zspage); > +ZSDESC_MATCH(page_type, first_obj_offset); > +ZSDESC_MATCH(_refcount, _refcount); > +#undef ZSDESC_MATCH > +static_assert(sizeof(struct zsdesc) <= sizeof(struct page)); > + > /* huge object: pages_per_zspage == 1 && maxobj_per_zspage == 1 */ > static void SetZsHugePage(struct zspage *zspage) > { > -- > 2.41.0 >