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 X-Spam-Level: X-Spam-Status: No, score=-7.3 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7778DC433B4 for ; Thu, 8 Apr 2021 09:02:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2E5C36044F for ; Thu, 8 Apr 2021 09:02:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230280AbhDHJCP (ORCPT ); Thu, 8 Apr 2021 05:02:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36424 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229998AbhDHJCN (ORCPT ); Thu, 8 Apr 2021 05:02:13 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C1E7BC061760 for ; Thu, 8 Apr 2021 02:02:00 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id e14so1711913ejz.11 for ; Thu, 08 Apr 2021 02:02:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rasmusvillemoes.dk; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=cXalpWPdovuqi5PtyyBVt6MR8In8wK+QHdjt9pvsaQ4=; b=hXItazSBCUJKTKFr8ty0kuL/11ikHtPiXUThWd8G8PO444TtM/DMLIuh6TLqS0P7W/ KA40sKleR67T20vW1C6bSQ6K0Fr0NqoOgi+bGrS48c3RSh5lQG5JlxMiv5Myj/gbL2At t3VNG06cCMARp0qjsyVCb+Z/sBuJ0tEt98J2s= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=cXalpWPdovuqi5PtyyBVt6MR8In8wK+QHdjt9pvsaQ4=; b=WnjheHh1+S741V6sEYaL3IdL9cvNyxeYi55ZIgW3FV23Z9ruOvyDhtJA4lavdemwFY x1ic22jfZWBtySbzkXNMsAuzd1k3zsyxQ/KofgI7C2FXNaUrR9ob7SLwtOAXMBLeMHZD ppC+VFBEHZfXfN08pD5fS17D639n9HDaX4vZ+OEJ61soDNHrYA4VTPHZLPnscAWovCLf 3XTHjyRdZqTarMUfnEqTHXrKjKpSstlnbC6/4yqz9heKGfDP0KM7w02qN3lHFjgQ03NN oaRBcgQCj0/NaBSChhCwv3ZRFFYS0r4MAXj+845ois4gyCrek6Rq0Zr0x3GzMbq0+KZU zwHw== X-Gm-Message-State: AOAM530Cu/NSTi2ebfvnwHiiqDjouzh4HkHHHoaetZ5D45UIbOY1ner2 gNf5myNt5SCVDASCzentFKsL6g== X-Google-Smtp-Source: ABdhPJzBa4HtKr4hNJ415kDMr8yGygx8z+sS2pW2rkqme7X4wimsY5DsOfWZUwuhrlrMqbDHdk49Vw== X-Received: by 2002:a17:906:3713:: with SMTP id d19mr8909450ejc.513.1617872518956; Thu, 08 Apr 2021 02:01:58 -0700 (PDT) Received: from [192.168.1.149] ([80.208.71.248]) by smtp.gmail.com with ESMTPSA id s6sm10262058ejv.11.2021.04.08.02.01.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 08 Apr 2021 02:01:58 -0700 (PDT) Subject: Re: [PATCH v6 01/27] mm: Introduce struct folio To: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-cachefs@redhat.com, linux-afs@lists.infradead.org References: <20210331184728.1188084-1-willy@infradead.org> <20210331184728.1188084-2-willy@infradead.org> From: Rasmus Villemoes Message-ID: Date: Thu, 8 Apr 2021 11:01:57 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.7.1 MIME-Version: 1.0 In-Reply-To: <20210331184728.1188084-2-willy@infradead.org> Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 31/03/2021 20.47, Matthew Wilcox (Oracle) wrote: > +static inline void folio_build_bug(void) > +{ > +#define FOLIO_MATCH(pg, fl) \ > +BUILD_BUG_ON(offsetof(struct page, pg) != offsetof(struct folio, fl)); > + > + FOLIO_MATCH(flags, flags); > + FOLIO_MATCH(lru, lru); > + FOLIO_MATCH(mapping, mapping); > + FOLIO_MATCH(index, index); > + FOLIO_MATCH(private, private); > + FOLIO_MATCH(_mapcount, _mapcount); > + FOLIO_MATCH(_refcount, _refcount); > +#ifdef CONFIG_MEMCG > + FOLIO_MATCH(memcg_data, memcg_data); > +#endif > +#undef FOLIO_MATCH > + BUILD_BUG_ON(sizeof(struct page) != sizeof(struct folio)); > +} > + Perhaps do this next to the definition of struct folio instead of hiding it in some arbitrary TU - hint, we have static_assert() that doesn't need to be in function context. And consider amending FOLIO_MATCH by a static_assert(__same_type(typeof_member(...), typeof_member(...))). Rasmus