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=-23.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=ham 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 02162C433B4 for ; Wed, 12 May 2021 16:09:36 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 77EF361D05 for ; Wed, 12 May 2021 16:09:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 77EF361D05 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A82DB6B006C; Wed, 12 May 2021 12:09:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A59B06B006E; Wed, 12 May 2021 12:09:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 887126B0070; Wed, 12 May 2021 12:09:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0155.hostedemail.com [216.40.44.155]) by kanga.kvack.org (Postfix) with ESMTP id 5489B6B006C for ; Wed, 12 May 2021 12:09:34 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id E25FB82499A8 for ; Wed, 12 May 2021 16:09:33 +0000 (UTC) X-FDA: 78133064226.15.FDD2F1A Received: from mail-yb1-f173.google.com (mail-yb1-f173.google.com [209.85.219.173]) by imf18.hostedemail.com (Postfix) with ESMTP id 0A24E200024E for ; Wed, 12 May 2021 16:09:34 +0000 (UTC) Received: by mail-yb1-f173.google.com with SMTP id v39so31365941ybd.4 for ; Wed, 12 May 2021 09:09:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=UC4aC5rKOriDRQF1zIVhdKtGPifq2qAliEYO7aR2x28=; b=rrS1iwzAJWorMpKRze1NjTj7ufj1heKJGnQIaVNstsWjj2rI1eZKyEhY3iOu/RQ6kN QH0tWFoc6fEIcq9sMgGxsfHo1r1kuQvg7AFAh3E7MyQ4FvzX7Bzy2U5BzfD5ZJmTiWrV bCJM9xBIkVOyqEGvqsVOSGVkKcUBBB3h0VRH8Or6l0RbemnbJac1Wlewr50oXkx3npjq I7LLflLWXrJqeTyXvuNSvVvvmHC10ZnEiRKks+pSfewpZLHC4MWCL9ovovcs+aQQRTMX AMLe8Eg+EoRF8yp9lykmieUzfGeDPWIq0PNi1+gr08HWbeNRTqWX1qqnM39qhebpVy4i jCIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=UC4aC5rKOriDRQF1zIVhdKtGPifq2qAliEYO7aR2x28=; b=CxSTV/Z8g64Eesf8GLp5sV5WK2HPG4klpJRyUFtSsIjGbHxyfOzOMSJ5TPaTWAOCUj OJAum+fMm3HCHwWxdw/0ZrLR299nvD1r3ydDLUDBIiYfMzb2WwJRFPvEfpcCWhLjWRL1 ygSBlaye77PU0FpJ20SGQqVQl9v8MgDrPNw8JqDL58SqAfxWcxZY2mSVGIIWLi8GyXBT zWZr58S3MPSlb3FtSy57KT/3myhVmka9kmJ3H59rw9DAtQxrie0qa/XfQituH7LkEMR4 VvUoZZRq1O04nNxndqjgBPbVGdaQUdw1NslTUdblUk6worJbjHcxBK7YyQXpxMwD7WUg VhdA== X-Gm-Message-State: AOAM530/nRGTBpn5UwQ9JE6LYtkXvvb7AcN20ApO7UTFwhfatmmfuJM1 pw0nrBqiRWigleK68Or1gKwRMTEC1pOcR0n8Yj/8Cg== X-Google-Smtp-Source: ABdhPJz15erT5HR/MU873lFrI6uDCwAq/V4gwb4hiYtUdYYMsRI/fihk2Q+OcXomoYZbpgym9Jb5/VArkhk/zjpBdwI= X-Received: by 2002:a25:4641:: with SMTP id t62mr52622502yba.253.1620835772321; Wed, 12 May 2021 09:09:32 -0700 (PDT) MIME-Version: 1.0 References: <20210511133118.15012-1-mcroce@linux.microsoft.com> <20210511133118.15012-2-mcroce@linux.microsoft.com> In-Reply-To: From: Eric Dumazet Date: Wed, 12 May 2021 18:09:21 +0200 Message-ID: Subject: Re: [PATCH net-next v4 1/4] mm: add a signature in struct page To: Matthew Wilcox Cc: Ilias Apalodimas , Matteo Croce , Networking , Linux-MM , Ayush Sawal , Vinay Kumar Yadav , Rohit Maheshwari , "David S. Miller" , Jakub Kicinski , Thomas Petazzoni , Marcin Wojtas , Russell King , Mirko Lindner , Stephen Hemminger , Tariq Toukan , Jesper Dangaard Brouer , Alexei Starovoitov , Daniel Borkmann , John Fastabend , Boris Pismenny , Arnd Bergmann , Andrew Morton , "Peter Zijlstra (Intel)" , Vlastimil Babka , Yu Zhao , Will Deacon , Michel Lespinasse , Fenghua Yu , Roman Gushchin , Hugh Dickins , Peter Xu , Jason Gunthorpe , Jonathan Lemon , Alexander Lobakin , Cong Wang , wenxu , Kevin Hao , Jakub Sitnicki , Marco Elver , Willem de Bruijn , Miaohe Lin , Yunsheng Lin , Guillaume Nault , open list , linux-rdma , bpf , David Ahern , Lorenzo Bianconi , Saeed Mahameed , Andrew Lunn , Paolo Abeni , Sven Auhagen Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=google.com header.s=20161025 header.b=rrS1iwzA; spf=pass (imf18.hostedemail.com: domain of edumazet@google.com designates 209.85.219.173 as permitted sender) smtp.mailfrom=edumazet@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspamd-Server: rspam01 X-Rspamd-Queue-Id: 0A24E200024E X-Stat-Signature: ax48pff9y7btdbpibi1xst8iu5jzt8tk Received-SPF: none (google.com>: No applicable sender policy available) receiver=imf18; identity=mailfrom; envelope-from=""; helo=mail-yb1-f173.google.com; client-ip=209.85.219.173 X-HE-DKIM-Result: pass/pass X-HE-Tag: 1620835774-704949 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 Wed, May 12, 2021 at 6:03 PM Matthew Wilcox wrote: > > On Tue, May 11, 2021 at 05:25:36PM +0300, Ilias Apalodimas wrote: > > Nope not at all, either would work. we'll switch to that > > You'll need something like this because of the current use of > page->index to mean "pfmemalloc". > > From ecd6d912056a21bbe55d997c01f96b0b8b9fbc31 Mon Sep 17 00:00:00 2001 > From: "Matthew Wilcox (Oracle)" > Date: Fri, 16 Apr 2021 18:12:33 -0400 > Subject: [PATCH] mm: Indicate pfmemalloc pages in compound_head > > The net page_pool wants to use a magic value to identify page pool pages. > The best place to put it is in the first word where it can be clearly a > non-pointer value. That means shifting dma_addr up to alias with ->index, > which means we need to find another way to indicate page_is_pfmemalloc(). > Since page_pool doesn't want to set its magic value on pages which are > pfmemalloc, we can use bit 1 of compound_head to indicate that the page > came from the memory reserves. > > Signed-off-by: Matthew Wilcox (Oracle) > --- > include/linux/mm.h | 12 +++++++----- > include/linux/mm_types.h | 7 +++---- > 2 files changed, 10 insertions(+), 9 deletions(-) > > diff --git a/include/linux/mm.h b/include/linux/mm.h > index bd21864449bf..4f9b2007efad 100644 > --- a/include/linux/mm.h > +++ b/include/linux/mm.h > @@ -1670,10 +1670,12 @@ struct address_space *page_mapping(struct page *page); > static inline bool page_is_pfmemalloc(const struct page *page) > { > /* > - * Page index cannot be this large so this must be > - * a pfmemalloc page. > + * This is not a tail page; compound_head of a head page is unused > + * at return from the page allocator, and will be overwritten > + * by callers who do not care whether the page came from the > + * reserves. > */ > - return page->index == -1UL; > + return page->compound_head & 2; > } > > /* > @@ -1682,12 +1684,12 @@ static inline bool page_is_pfmemalloc(const struct page *page) > */ > static inline void set_page_pfmemalloc(struct page *page) > { > - page->index = -1UL; > + page->compound_head = 2; > } > > static inline void clear_page_pfmemalloc(struct page *page) > { > - page->index = 0; > + page->compound_head = 0; > } > > /* > diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h > index 5aacc1c10a45..1352e278939b 100644 > --- a/include/linux/mm_types.h > +++ b/include/linux/mm_types.h > @@ -96,10 +96,9 @@ struct page { > unsigned long private; > }; > struct { /* page_pool used by netstack */ > - /** > - * @dma_addr: might require a 64-bit value on > - * 32-bit architectures. > - */ > + unsigned long pp_magic; > + struct page_pool *pp; > + unsigned long _pp_mapping_pad; > unsigned long dma_addr[2]; > }; > struct { /* slab, slob and slub */ > -- > 2.30.2 > This would break compound_head() ?