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=-5.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 4E608C433B4 for ; Wed, 14 Apr 2021 08:11:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37162613C4 for ; Wed, 14 Apr 2021 08:11:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346620AbhDNILf (ORCPT ); Wed, 14 Apr 2021 04:11:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:46483 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350026AbhDNILT (ORCPT ); Wed, 14 Apr 2021 04:11:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618387858; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EwYB5nz8yfF5tg561fCrH5gbdVVTxmjpf7rPCaT4AzE=; b=VGZ8i1hPy7va5Wi5riAwrzaKM30fcXyJiug3eVoElCFdaUzSiu1D6doFSe5Jc2YYMssf3e 75XHVoiBL3m8gIevH9rSQsdN4FoKYEeor+zZKCZE/+CYYBkTzPplT2bBDecCbxPhkTiF8D VsfXf32iu3XIn7KE8tRFeMOR+DACL70= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-595-uxPR0e8iMvqotYdo8VKEqQ-1; Wed, 14 Apr 2021 04:10:54 -0400 X-MC-Unique: uxPR0e8iMvqotYdo8VKEqQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E40087504F; Wed, 14 Apr 2021 08:10:52 +0000 (UTC) Received: from carbon (unknown [10.36.110.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4FFE5D9CA; Wed, 14 Apr 2021 08:10:45 +0000 (UTC) Date: Wed, 14 Apr 2021 10:10:44 +0200 From: Jesper Dangaard Brouer To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, Ilias Apalodimas , Matteo Croce , Grygorii Strashko , Arnd Bergmann , Christoph Hellwig , brouer@redhat.com Subject: Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems Message-ID: <20210414101044.19da09df@carbon> In-Reply-To: <20210412011532.GG2531743@casper.infradead.org> References: <20210410205246.507048-1-willy@infradead.org> <20210410205246.507048-2-willy@infradead.org> <20210411114307.5087f958@carbon> <20210411103318.GC2531743@casper.infradead.org> <20210412011532.GG2531743@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 12 Apr 2021 02:15:32 +0100 Matthew Wilcox wrote: > On Sun, Apr 11, 2021 at 11:33:18AM +0100, Matthew Wilcox wrote: > > Basically, we have three aligned dwords here. We can either alias with > > @flags and the first word of @lru, or the second word of @lru and @mapping, > > or @index and @private. @flags is a non-starter. If we use @mapping, > > then you have to set it to NULL before you free it, and I'm not sure > > how easy that will be for you. If that's trivial, then we could use > > the layout: > > > > unsigned long _pp_flags; > > unsigned long pp_magic; > > union { > > dma_addr_t dma_addr; /* might be one or two words */ > > unsigned long _pp_align[2]; > > }; > > unsigned long pp_pfmemalloc; > > unsigned long xmi; > > I forgot about the munmap path. That calls zap_page_range() which calls > set_page_dirty() which calls page_mapping(). If we use page->mapping, > that's going to get interpreted as an address_space pointer. > > *sigh*. Foiled at every turn. Yes, indeed! - And very frustrating. It's keeping me up at night. I'm dreaming about 32 vs 64 bit data structures. My fitbit stats tell me that I don't sleep well with these kind of dreams ;-) > I'm kind of inclined towards using two (or more) bits for PageSlab as > we discussed here: > > https://lore.kernel.org/linux-mm/01000163efe179fe-d6270c58-eaba-482f-a6bd-334667250ef7-000000@email.amazonses.com/ > > so we have PageKAlloc that's true for PageSlab, PagePool, PageDMAPool, > PageVMalloc, PageFrag and maybe a few other kernel-internal allocations. I actually like this idea a lot. I also think it will solve or remove Matteo/Ilias'es[2] need to introduce the pp_magic signature. Ilias do say[1] that page_pool pages could be used for TCP RX zerocopy, but I don't think we should "allow" that (meaning page_pool should drop the DMA-mapping and give up recycling). I should argue why in that thread. That said, I think we need to have a quicker fix for the immediate issue with 64-bit bit dma_addr on 32-bit arch and the misalignment hole it leaves[3] in struct page. In[3] you mention ppc32, does it only happens on certain 32-bit archs? I'm seriously considering removing page_pool's support for doing/keeping DMA-mappings on 32-bit arch's. AFAIK only a single driver use this. > (see also here:) > https://lore.kernel.org/linux-mm/20180518194519.3820-18-willy@infradead.org/ [1] https://lore.kernel.org/netdev/YHHuE7g73mZNrMV4@enceladus/ [2] https://patchwork.kernel.org/project/netdevbpf/patch/20210409223801.104657-3-mcroce@linux.microsoft.com/ [3] https://lore.kernel.org/linux-mm/20210410024313.GX2531743@casper.infradead.org/ -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer 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=-3.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS 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 A4574C433B4 for ; Wed, 14 Apr 2021 08:11:33 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 159F961222 for ; Wed, 14 Apr 2021 08:11:32 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 159F961222 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from boromir.ozlabs.org (localhost [IPv6:::1]) by lists.ozlabs.org (Postfix) with ESMTP id 4FKwD31rZMz3byD for ; Wed, 14 Apr 2021 18:11:31 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HMolz8eO; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HMolz8eO; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=216.205.24.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=brouer@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HMolz8eO; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=HMolz8eO; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4FKwCY40Ygz2y88 for ; Wed, 14 Apr 2021 18:11:03 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618387859; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EwYB5nz8yfF5tg561fCrH5gbdVVTxmjpf7rPCaT4AzE=; b=HMolz8eOSdDUm58k+BoSjmoFt0Pc0ZpSkL1VXLQfbNEn5GFrY30WkJLFtY7yCuigxk9VJe Z1xb9i3LO1EzSQWGA77V0xFV3Af7539rv5i9fXbrDG8HOsmWtVAam8q9s4QdR754CjM4nC f3jNj0CWtz94qD3lrH/a2mXXg5yr4jY= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618387859; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EwYB5nz8yfF5tg561fCrH5gbdVVTxmjpf7rPCaT4AzE=; b=HMolz8eOSdDUm58k+BoSjmoFt0Pc0ZpSkL1VXLQfbNEn5GFrY30WkJLFtY7yCuigxk9VJe Z1xb9i3LO1EzSQWGA77V0xFV3Af7539rv5i9fXbrDG8HOsmWtVAam8q9s4QdR754CjM4nC f3jNj0CWtz94qD3lrH/a2mXXg5yr4jY= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-595-uxPR0e8iMvqotYdo8VKEqQ-1; Wed, 14 Apr 2021 04:10:54 -0400 X-MC-Unique: uxPR0e8iMvqotYdo8VKEqQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E40087504F; Wed, 14 Apr 2021 08:10:52 +0000 (UTC) Received: from carbon (unknown [10.36.110.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4FFE5D9CA; Wed, 14 Apr 2021 08:10:45 +0000 (UTC) Date: Wed, 14 Apr 2021 10:10:44 +0200 From: Jesper Dangaard Brouer To: Matthew Wilcox Subject: Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems Message-ID: <20210414101044.19da09df@carbon> In-Reply-To: <20210412011532.GG2531743@casper.infradead.org> References: <20210410205246.507048-1-willy@infradead.org> <20210410205246.507048-2-willy@infradead.org> <20210411114307.5087f958@carbon> <20210411103318.GC2531743@casper.infradead.org> <20210412011532.GG2531743@casper.infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Grygorii Strashko , netdev@vger.kernel.org, Ilias Apalodimas , linux-mips@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, brouer@redhat.com, Matteo Croce , linuxppc-dev@lists.ozlabs.org, Christoph Hellwig , linux-arm-kernel@lists.infradead.org Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" On Mon, 12 Apr 2021 02:15:32 +0100 Matthew Wilcox wrote: > On Sun, Apr 11, 2021 at 11:33:18AM +0100, Matthew Wilcox wrote: > > Basically, we have three aligned dwords here. We can either alias with > > @flags and the first word of @lru, or the second word of @lru and @mapping, > > or @index and @private. @flags is a non-starter. If we use @mapping, > > then you have to set it to NULL before you free it, and I'm not sure > > how easy that will be for you. If that's trivial, then we could use > > the layout: > > > > unsigned long _pp_flags; > > unsigned long pp_magic; > > union { > > dma_addr_t dma_addr; /* might be one or two words */ > > unsigned long _pp_align[2]; > > }; > > unsigned long pp_pfmemalloc; > > unsigned long xmi; > > I forgot about the munmap path. That calls zap_page_range() which calls > set_page_dirty() which calls page_mapping(). If we use page->mapping, > that's going to get interpreted as an address_space pointer. > > *sigh*. Foiled at every turn. Yes, indeed! - And very frustrating. It's keeping me up at night. I'm dreaming about 32 vs 64 bit data structures. My fitbit stats tell me that I don't sleep well with these kind of dreams ;-) > I'm kind of inclined towards using two (or more) bits for PageSlab as > we discussed here: > > https://lore.kernel.org/linux-mm/01000163efe179fe-d6270c58-eaba-482f-a6bd-334667250ef7-000000@email.amazonses.com/ > > so we have PageKAlloc that's true for PageSlab, PagePool, PageDMAPool, > PageVMalloc, PageFrag and maybe a few other kernel-internal allocations. I actually like this idea a lot. I also think it will solve or remove Matteo/Ilias'es[2] need to introduce the pp_magic signature. Ilias do say[1] that page_pool pages could be used for TCP RX zerocopy, but I don't think we should "allow" that (meaning page_pool should drop the DMA-mapping and give up recycling). I should argue why in that thread. That said, I think we need to have a quicker fix for the immediate issue with 64-bit bit dma_addr on 32-bit arch and the misalignment hole it leaves[3] in struct page. In[3] you mention ppc32, does it only happens on certain 32-bit archs? I'm seriously considering removing page_pool's support for doing/keeping DMA-mappings on 32-bit arch's. AFAIK only a single driver use this. > (see also here:) > https://lore.kernel.org/linux-mm/20180518194519.3820-18-willy@infradead.org/ [1] https://lore.kernel.org/netdev/YHHuE7g73mZNrMV4@enceladus/ [2] https://patchwork.kernel.org/project/netdevbpf/patch/20210409223801.104657-3-mcroce@linux.microsoft.com/ [3] https://lore.kernel.org/linux-mm/20210410024313.GX2531743@casper.infradead.org/ -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer 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=-3.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS 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 5810DC433B4 for ; Wed, 14 Apr 2021 08:12:56 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id CBF59613A9 for ; Wed, 14 Apr 2021 08:12:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org CBF59613A9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID: Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=PttLDeZV9SbVwXSGh25U3B8l6BwiEoRvY0XIU4mIxGU=; b=lqM+2tr1mx4GuHaAWWa1PCeF1 cUAKvyTP5FT37ZUMKWVetZlHE4ShEHjRhDaTTr37HnrTqjygwncfGtrpAWDXhdCgUhX/T4BdQqNMu lpv3ilX+kHO2cthBZ7Wf9TgmeOcvwmFML3ePnGICVsj51nK/MCjG50yAC/43ezAmhGB6RRFu1erQA BRMFlLvn2BA+W7tsKHui1Vl8MrmHs5maXZcyHv/1v2BzgO0paFDMPtS/syg6W4Ox2NBTdanfp3lqn otwtgt4scfAMYV11f386clL3OmV3O0zeWRVXKyKOV45w1XlI3LnRCTzxDJZSLiA3YiKQK4hD3yHh8 muN+GkRLg==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lWac8-00BwAM-3X; Wed, 14 Apr 2021 08:11:09 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWac2-00Bw9g-Ou for linux-arm-kernel@desiato.infradead.org; Wed, 14 Apr 2021 08:11:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Subject:Cc:To: From:Date:Sender:Reply-To:Content-ID:Content-Description; bh=EwYB5nz8yfF5tg561fCrH5gbdVVTxmjpf7rPCaT4AzE=; b=W7Cqi22x9xjr6vI8n2sAkqSoJQ qJTJj9/z8UngYNu/B5gYn7odXaHGvjinjbKMt0bjjMlxGN1qPkgxsRhVvZ5ChOqWjrPcnPUdGuVCx Y353QLSq9rB3FTsQaawLK2BhS+j6dCNLmgfmyuo1carmwFevJdMGD63gN+5Wvk9TMnMBIpO0rODIW STPojSAs+LdQHP8h040yE23CaiYnIPKJblA2cOnQSdUDMSOuy0zUGEgRqUUDp1tsyOD8fCFLzzIaN moZmSmAYptVGfWGSNhGYaQ4wI95/UxN6uNitWQAtubPdNVyVpNwzd8ilSHWLA3f1cC4JVfySAR48A lBOwlRIw==; Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lWabz-007b31-Ps for linux-arm-kernel@lists.infradead.org; Wed, 14 Apr 2021 08:11:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618387857; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=EwYB5nz8yfF5tg561fCrH5gbdVVTxmjpf7rPCaT4AzE=; b=LXxmECgSxCEzoIMOehaD1mPIswEhibo5RGmsyBaoDSSHOnwkcd3QiR1HHYvRu0MQT2tpXY sSjZIX5qIbHbRHFhRaYFXljiD48NACsuw3kSOii/S7CsqGSAHFGunjlNwK3xOMJ3y1xePh FWcvBQK5cUD9FYhJ+0ru5jIsV3G+nr0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-595-uxPR0e8iMvqotYdo8VKEqQ-1; Wed, 14 Apr 2021 04:10:54 -0400 X-MC-Unique: uxPR0e8iMvqotYdo8VKEqQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5E40087504F; Wed, 14 Apr 2021 08:10:52 +0000 (UTC) Received: from carbon (unknown [10.36.110.19]) by smtp.corp.redhat.com (Postfix) with ESMTP id C4FFE5D9CA; Wed, 14 Apr 2021 08:10:45 +0000 (UTC) Date: Wed, 14 Apr 2021 10:10:44 +0200 From: Jesper Dangaard Brouer To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, Ilias Apalodimas , Matteo Croce , Grygorii Strashko , Arnd Bergmann , Christoph Hellwig , brouer@redhat.com Subject: Re: [PATCH 1/1] mm: Fix struct page layout on 32-bit systems Message-ID: <20210414101044.19da09df@carbon> In-Reply-To: <20210412011532.GG2531743@casper.infradead.org> References: <20210410205246.507048-1-willy@infradead.org> <20210410205246.507048-2-willy@infradead.org> <20210411114307.5087f958@carbon> <20210411103318.GC2531743@casper.infradead.org> <20210412011532.GG2531743@casper.infradead.org> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210414_011059_930851_FBBC393E X-CRM114-Status: GOOD ( 26.55 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 12 Apr 2021 02:15:32 +0100 Matthew Wilcox wrote: > On Sun, Apr 11, 2021 at 11:33:18AM +0100, Matthew Wilcox wrote: > > Basically, we have three aligned dwords here. We can either alias with > > @flags and the first word of @lru, or the second word of @lru and @mapping, > > or @index and @private. @flags is a non-starter. If we use @mapping, > > then you have to set it to NULL before you free it, and I'm not sure > > how easy that will be for you. If that's trivial, then we could use > > the layout: > > > > unsigned long _pp_flags; > > unsigned long pp_magic; > > union { > > dma_addr_t dma_addr; /* might be one or two words */ > > unsigned long _pp_align[2]; > > }; > > unsigned long pp_pfmemalloc; > > unsigned long xmi; > > I forgot about the munmap path. That calls zap_page_range() which calls > set_page_dirty() which calls page_mapping(). If we use page->mapping, > that's going to get interpreted as an address_space pointer. > > *sigh*. Foiled at every turn. Yes, indeed! - And very frustrating. It's keeping me up at night. I'm dreaming about 32 vs 64 bit data structures. My fitbit stats tell me that I don't sleep well with these kind of dreams ;-) > I'm kind of inclined towards using two (or more) bits for PageSlab as > we discussed here: > > https://lore.kernel.org/linux-mm/01000163efe179fe-d6270c58-eaba-482f-a6bd-334667250ef7-000000@email.amazonses.com/ > > so we have PageKAlloc that's true for PageSlab, PagePool, PageDMAPool, > PageVMalloc, PageFrag and maybe a few other kernel-internal allocations. I actually like this idea a lot. I also think it will solve or remove Matteo/Ilias'es[2] need to introduce the pp_magic signature. Ilias do say[1] that page_pool pages could be used for TCP RX zerocopy, but I don't think we should "allow" that (meaning page_pool should drop the DMA-mapping and give up recycling). I should argue why in that thread. That said, I think we need to have a quicker fix for the immediate issue with 64-bit bit dma_addr on 32-bit arch and the misalignment hole it leaves[3] in struct page. In[3] you mention ppc32, does it only happens on certain 32-bit archs? I'm seriously considering removing page_pool's support for doing/keeping DMA-mappings on 32-bit arch's. AFAIK only a single driver use this. > (see also here:) > https://lore.kernel.org/linux-mm/20180518194519.3820-18-willy@infradead.org/ [1] https://lore.kernel.org/netdev/YHHuE7g73mZNrMV4@enceladus/ [2] https://patchwork.kernel.org/project/netdevbpf/patch/20210409223801.104657-3-mcroce@linux.microsoft.com/ [3] https://lore.kernel.org/linux-mm/20210410024313.GX2531743@casper.infradead.org/ -- Best regards, Jesper Dangaard Brouer MSc.CS, Principal Kernel Engineer at Red Hat LinkedIn: http://www.linkedin.com/in/brouer _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel