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 79499C433FE for ; Tue, 1 Nov 2022 17:24:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1EF736B0071; Tue, 1 Nov 2022 13:24:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 19FC86B0073; Tue, 1 Nov 2022 13:24:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 090436B0074; Tue, 1 Nov 2022 13:24:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id ED7656B0071 for ; Tue, 1 Nov 2022 13:24:22 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id B59A314020A for ; Tue, 1 Nov 2022 17:24:22 +0000 (UTC) X-FDA: 80085547164.07.87C9F15 Received: from verein.lst.de (verein.lst.de [213.95.11.211]) by imf15.hostedemail.com (Postfix) with ESMTP id E52C6A000E for ; Tue, 1 Nov 2022 17:24:21 +0000 (UTC) Received: by verein.lst.de (Postfix, from userid 2407) id 0116E6732D; Tue, 1 Nov 2022 18:24:16 +0100 (CET) Date: Tue, 1 Nov 2022 18:24:16 +0100 From: Christoph Hellwig To: Catalin Marinas Cc: Christoph Hellwig , Greg Kroah-Hartman , Linus Torvalds , Arnd Bergmann , Will Deacon , Marc Zyngier , Andrew Morton , Herbert Xu , Ard Biesheuvel , Isaac Manjarres , Saravana Kannan , linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 2/2] treewide: Add the __GFP_PACKED flag to several non-DMA kmalloc() allocations Message-ID: <20221101172416.GB20381@lst.de> References: <20221030084718.GC5278@lst.de> <20221030091349.GA5600@lst.de> <20221101105919.GA13872@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.17 (2007-11-01) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1667323462; 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; bh=rQiKF+ZsBjXERICUM0eF7NTmXK4lgSVg7DAeRBCYfJs=; b=TfJIQXYvwqZVIEVcadeC/vukAJiVASxEmmWw84wT10IIEOKI6zgacjZIi1Yrmt4VzB0T+F iJsN98Pxq4AbkUKiCF8WeuYouiDUBMeOD5TtFnId4fV97z2hrafGKqnKS+7i9zbKZTCCy9 GKXoKeA0SZLSDG9JTYDsNq+gy+oPGjU= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=none (imf15.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1667323462; a=rsa-sha256; cv=none; b=iBT6jtuhLyGSdG0aW2VU22TSpE+IhcmaKj61ezxPTIeHhUicLigVHAa5363GyqyIe64/PK KsQO3OH6lOaYyUCJz4zLpMaF7zk/3HJflLKnabFq2nD6ESAjjZQmS+GOIFuIZzWgj5nFZZ FwK+g/vEbhri3B7Y3lpw9oknGVetRvU= X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: E52C6A000E Authentication-Results: imf15.hostedemail.com; dkim=none; spf=none (imf15.hostedemail.com: domain of hch@lst.de has no SPF policy when checking 213.95.11.211) smtp.mailfrom=hch@lst.de; dmarc=none X-Stat-Signature: 5iomuzo9xexu7tcjs34pwmcu8i8w3ecw X-HE-Tag: 1667323461-722234 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 Tue, Nov 01, 2022 at 05:19:46PM +0000, Catalin Marinas wrote: > > The main downside of bouncing is mobile phones where those vendors are > in the habit of passing noswiotlb on the kernel command line or they > want a very small bounce buffer (hard to pick a universally small size). > I guess we can go ahead with this and, depending on how bad the problem > is, we can look at optimising swiotlb to use a kmem_cache (or aligned > kmalloc) as fall-back for bouncing. Theses phones setups are completely broken already. There is a reason why it needs a debug option to disable swiotlb, and that reason is that Linux guarantees that the 32-bit DMA always works. If they force swiotlb off they can keep the pieces as this is not a supported configuration. > As a less than optimal solution, we can force bouncing for the whole > list if any of the sg elements is below the alignment size. Hopefully we > won't have many such mixed size cases. I suspect we won't see any such cases. The scatterlist is usually used for large data transfers, and many devices won't like unaligned buffers for SG operations to start with. So I think it is a perfectly fine tradeoff.