From patchwork Wed Jul 14 02:34:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dave Chinner X-Patchwork-Id: 12375651 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=-6.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT 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 EB4BAC07E95 for ; Wed, 14 Jul 2021 02:34:51 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 984DB61154 for ; Wed, 14 Jul 2021 02:34:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 984DB61154 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=fromorbit.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A0D916B008C; Tue, 13 Jul 2021 22:34:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A4B26B0095; Tue, 13 Jul 2021 22:34:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8373C6B0092; Tue, 13 Jul 2021 22:34:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0076.hostedemail.com [216.40.44.76]) by kanga.kvack.org (Postfix) with ESMTP id 549766B0088 for ; Tue, 13 Jul 2021 22:34:51 -0400 (EDT) Received: from smtpin32.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4EC6A82E0EE3 for ; Wed, 14 Jul 2021 02:34:50 +0000 (UTC) X-FDA: 78359625540.32.BA994E8 Received: from mail107.syd.optusnet.com.au (mail107.syd.optusnet.com.au [211.29.132.53]) by imf26.hostedemail.com (Postfix) with ESMTP id C8B1E20019D7 for ; Wed, 14 Jul 2021 02:34:49 +0000 (UTC) Received: from dread.disaster.area (pa49-181-34-10.pa.nsw.optusnet.com.au [49.181.34.10]) by mail107.syd.optusnet.com.au (Postfix) with ESMTPS id 137BA5EB0; Wed, 14 Jul 2021 12:34:47 +1000 (AEST) Received: from discord.disaster.area ([192.168.253.110]) by dread.disaster.area with esmtp (Exim 4.92.3) (envelope-from ) id 1m3UjW-006Hee-PQ; Wed, 14 Jul 2021 12:34:46 +1000 Received: from dave by discord.disaster.area with local (Exim 4.94) (envelope-from ) id 1m3UjW-00Awef-Ev; Wed, 14 Jul 2021 12:34:46 +1000 From: Dave Chinner To: linux-xfs@vger.kernel.org Cc: linux-mm@kvack.org Subject: [PATCH 0/3 v3] xfs, mm: memory allocation improvements Date: Wed, 14 Jul 2021 12:34:37 +1000 Message-Id: <20210714023440.2608690-1-david@fromorbit.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.3 cv=YKPhNiOx c=1 sm=1 tr=0 a=hdaoRb6WoHYrV466vVKEyw==:117 a=hdaoRb6WoHYrV466vVKEyw==:17 a=e_q4qTt1xDgA:10 a=VwQbUJbxAAAA:8 a=7-415B0cAAAA:8 a=QLtZUzOzXB423iHX4GcA:9 a=AjGcO6oz07-iQ99wixmX:22 a=biEYGPWJfzWAr4FL6Ov7:22 Authentication-Results: imf26.hostedemail.com; dkim=none; spf=none (imf26.hostedemail.com: domain of david@fromorbit.com has no SPF policy when checking 211.29.132.53) smtp.mailfrom=david@fromorbit.com; dmarc=none X-Rspamd-Server: rspam02 X-Stat-Signature: xcd85t35fbqt461pf96xqgr8cacahwwk X-Rspamd-Queue-Id: C8B1E20019D7 X-HE-Tag: 1626230089-748753 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000166, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: We're slowly trying to move the XFS code closer to the common memory allocation routines everyone else uses. This patch set addresses a regression from a previous set of changes (kmem_realloc() removal) and removes another couple of kmem wrappers from within the XFS code. The first patch addresses a regression - using large directory blocks triggers a warning when calling krealloc() recombine a buffer split across across two log records into a single contiguous memory buffer. this results in krealloc() being called to allocate a 64kB buffer with __GFP_NOFAIL being set. This warning is trivially reproduced by generic/040 and generic/041 when run with 64kB directory block sizes on a 4kB page size machine. Log recovery really needs to use kvmalloc() like all the other "allocate up to 64kB and can't fail" cases in filesystem code (e.g. for xattrs), but there's no native kvrealloc() function that provides us with the necessary semantics. So rather than add a new wrapper, the first patch adds this helper to the common code and converts XFS to use it for log recovery. The latter two patches are removing what are essentially kvmalloc() wrappers from XFS. With the more widespread use of memalloc_nofs_save/restore(), we can call kvmalloc(GFP_KERNEL) and just have it do the right thing because GFP_NOFS contexts are covered by PF_MEMALLOC_NOFS task flags now. Hence we don't need kmem_alloc_large() anymore. And with the slab code guaranteeing at least 512 byte alignment for sector and block sized heap allocations, we no longer need the kmem_alloc_io() variant of kmem_alloc_large() for IO buffers. So these wrappers can all go away... Version 3: - rebase on v5.14-rc1 - handle kvrealloc() failure in xlog_recover_add_to_cont_trans() Version 2: - https://lore.kernel.org/linux-xfs/20210630061431.1750745-1-david@fromorbit.com/ - rebase on v5.13 + xfs/for-next - moved kvrealloc() to mm/util.c - made incoming pointer const void * - added null check for vmalloc() failure - removed xfs_buftarg_dma_alignment() Original: - https://lore.kernel.org/linux-xfs/20210625023029.1472466-1-david@fromorbit.com/