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 95E3EECAAD5 for ; Tue, 30 Aug 2022 03:36:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0875A6B0073; Mon, 29 Aug 2022 23:36:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 03673940007; Mon, 29 Aug 2022 23:36:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E40676B0075; Mon, 29 Aug 2022 23:36:44 -0400 (EDT) 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 D47DE6B0073 for ; Mon, 29 Aug 2022 23:36:44 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id A5267120DC6 for ; Tue, 30 Aug 2022 03:36:44 +0000 (UTC) X-FDA: 79854847128.10.BA1C8B4 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf16.hostedemail.com (Postfix) with ESMTP id 5484E18001F for ; Tue, 30 Aug 2022 03:36:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=uRgJgJxuAtkFqhcrFtpIXGr2qJkeEfRvFFtV3MUVJKg=; b=lkuoSRY94uq2I9RzVPvlgPl/F7 cGGeAzHCVeMN62Xg4IT6DYHHKK0fpb2+Mb0hd8nxm1VQLJLa1tY2shASO5agTDTJXlOzRLcZc/7ZL mIsu3IdwedATtQHfPPEOB4P92SPM48epx0gUdPkVZm2lJwVteJHt6Nb9v6vUoiH8WqOFb+raYYZ8f 8uW6MjNEWE+HlEGVQmgq28ODTxPhtwYpBYyv4cQ3x+7OgPZRGNmRsSGwnbJSTk5+1nXjS+WsoTk4o OQpLgaCSlzxZ3cqU3nHhLuuRwSE5v/WNtaAy/BNWH/vdyp2MNfyjeZxbACQHwPNy75KxHpxunyw7R +GxItWOg==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSs3I-003e6W-GS; Tue, 30 Aug 2022 03:36:36 +0000 Date: Tue, 30 Aug 2022 04:36:36 +0100 From: Matthew Wilcox To: Sidhartha Kumar Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, songmuchun@bytedance.com, mike.kravetz@oracle.com, vbabka@suse.cz, william.kucharski@oracle.com, dhowells@redhat.com, peterx@redhat.com, arnd@arndb.de, ccross@google.com, hughd@google.com, ebiederm@xmission.com Subject: Re: [PATCH 2/7] mm: add private field of first tail to struct page and struct folio Message-ID: References: <20220829230014.384722-1-sidhartha.kumar@oracle.com> <20220829230014.384722-3-sidhartha.kumar@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220829230014.384722-3-sidhartha.kumar@oracle.com> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1661830603; 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=uRgJgJxuAtkFqhcrFtpIXGr2qJkeEfRvFFtV3MUVJKg=; b=2EfeXbxJQ/INfu9kej36irqG3+QfT1lTxnCU9VDNfmHAldTQmYviycnoV5S5B+bb37TXJM UPDmhgQa8KD6mo3kdIShvOIHNX7n20CocJvPHF5UPYf+tGQ/0AgpaQ1dzN74HfH0CdOWJx TRBtNgzeU+0TgKTNDjeKgLt1PIsmq3U= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=lkuoSRY9; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1661830603; a=rsa-sha256; cv=none; b=BbLnU/34Onm9cnfPFTjCEcR7ecEg3Ff08bcbq3VRiZ599/XlIujrVtwMS6LBZaSpWV6yU1 yyazc1wiOaSaMOc6MO3ByBrwnehz8Whtn782GWbMHyENcldpDTi0mF/tVmJRUVe6tTMX20 7Dfvm8E21G+2pb0p11h5SGyYAsyPSbE= X-Rspam-User: X-Rspamd-Queue-Id: 5484E18001F X-Stat-Signature: rfstbcm4156auh3syyqt1w9smc89juxu Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=infradead.org header.s=casper.20170209 header.b=lkuoSRY9; spf=none (imf16.hostedemail.com: domain of willy@infradead.org has no SPF policy when checking 90.155.50.34) smtp.mailfrom=willy@infradead.org; dmarc=none X-Rspamd-Server: rspam08 X-HE-Tag: 1661830603-329957 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 Mon, Aug 29, 2022 at 04:00:09PM -0700, Sidhartha Kumar wrote: > +++ b/include/linux/mm_types.h > @@ -144,6 +144,7 @@ struct page { > #ifdef CONFIG_64BIT > unsigned int compound_nr; /* 1 << compound_order */ > #endif > + unsigned long _private_1; > }; > struct { /* Second tail page of compound page */ > unsigned long _compound_pad_1; /* compound_head */ Have you tested compiling this on 32-bit? I think you need to move the _private_1 inside the ifdef CONFIG_64BIT. > @@ -251,6 +252,7 @@ struct page { > * @_total_mapcount: Do not use directly, call folio_entire_mapcount(). > * @_pincount: Do not use directly, call folio_maybe_dma_pinned(). > * @_folio_nr_pages: Do not use directly, call folio_nr_pages(). > + * @_private_1: Do not use directly, call folio_get_private_1(). > * > * A folio is a physically, virtually and logically contiguous set > * of bytes. It is a power-of-two in size, and it is aligned to that > @@ -298,6 +300,8 @@ struct folio { > #ifdef CONFIG_64BIT > unsigned int _folio_nr_pages; > #endif > + unsigned long _private_1; (but don't do that here!) The intent is that _private_1 lines up with head[1].private on 32-bit. It's a bit tricky, and I'm not sure that I'm thinking about it quite right. > }; > > #define FOLIO_MATCH(pg, fl) \ > @@ -325,6 +329,7 @@ FOLIO_MATCH(compound_mapcount, _total_mapcount); > FOLIO_MATCH(compound_pincount, _pincount); > #ifdef CONFIG_64BIT > FOLIO_MATCH(compound_nr, _folio_nr_pages); > +FOLIO_MATCH(_private_1, _private_1); > #endif > #undef FOLIO_MATCH > > @@ -370,6 +375,16 @@ static inline void *folio_get_private(struct folio *folio) > return folio->private; > } > > +static inline void folio_set_private_1(struct folio *folio, unsigned long private) > +{ > + folio->_private_1 = private; > +} > + > +static inline unsigned long folio_get_private_1(struct folio *folio) > +{ > + return folio->_private_1; > +} > + > struct page_frag_cache { > void * va; > #if (PAGE_SIZE < PAGE_FRAG_CACHE_MAX_SIZE) > -- > 2.31.1 >