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 99C27C30653 for ; Thu, 4 Jul 2024 22:06:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 09F886B009E; Thu, 4 Jul 2024 18:06:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 028726B00B7; Thu, 4 Jul 2024 18:06:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DE3D06B00C8; Thu, 4 Jul 2024 18:06:58 -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 BFDF86B00B4 for ; Thu, 4 Jul 2024 18:06:58 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 3A9161C2B47 for ; Thu, 4 Jul 2024 22:06:58 +0000 (UTC) X-FDA: 82303456116.09.DAF493E Received: from mail-pg1-f170.google.com (mail-pg1-f170.google.com [209.85.215.170]) by imf24.hostedemail.com (Postfix) with ESMTP id 4100E180016 for ; Thu, 4 Jul 2024 22:06:56 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=SqaH503V; spf=pass (imf24.hostedemail.com: domain of david@fromorbit.com designates 209.85.215.170 as permitted sender) smtp.mailfrom=david@fromorbit.com; dmarc=pass (policy=quarantine) header.from=fromorbit.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720130803; 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=dFaYOWLt8is5D9As9aNtsr+qR/ekBHXt5qOy8aEh680=; b=2rrHfACtmuF/E6LxpX5Rnlk9lfufNR3vbWhSx4ZDsPy+coJM6j5zuNwxKaxijVmsam8mEj HV9JqOoyGtvM54vNjeGQPS5s3gNntE9Ke9FIIsSIUgh6SlehQoxQy1Vw+Cq1PkzQDeNrPZ fQtyugY6RcuwKJbBGiYeEbzcrR2UJWs= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=SqaH503V; spf=pass (imf24.hostedemail.com: domain of david@fromorbit.com designates 209.85.215.170 as permitted sender) smtp.mailfrom=david@fromorbit.com; dmarc=pass (policy=quarantine) header.from=fromorbit.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720130803; a=rsa-sha256; cv=none; b=8oSqaWP18N4p1nR8fqM8hx5cYEK/h/GboyBL1Q5tsst0F24+ukRieaI/bRIbSblekDlnfE 8uy5owhg/Z0bqSaIx9W6tp/YFnz6c5aeoqnfU6CUG0Wpp/XKji19XC+PTOaObVATGWG4rD 1C84Kb08fDp4404t2FcYWzwZvqaJYgo= Received: by mail-pg1-f170.google.com with SMTP id 41be03b00d2f7-707040e3018so670196a12.1 for ; Thu, 04 Jul 2024 15:06:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1720130815; x=1720735615; darn=kvack.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=dFaYOWLt8is5D9As9aNtsr+qR/ekBHXt5qOy8aEh680=; b=SqaH503Va8CCHgb8ArHxr+Lssol1r1OvHGDuHawgbax0n3yo1KKidQbBfHiy38KvcE gVcv3q6Wd9P9GIuce2o7ai+nxBxvHFheYL8vzdPeifge0bmONiKUAp59fNmX6q9IJQIC yWc3HaLCbQl+y/QaBK2Em0QRqGl3tknjh3MMvtQ7JsMnZYYhSMtgxQSvpgcBDbw3qSZA 60YxiSwpyieZa6s6AZ80tchTuGNyMr4IT8TO4Lda3V/fY8Z29proeHxize8ZygBibVuJ A3J+iw+YAWRnBoMlsJAlH4i0ze4uHybbmZVLqqQ5Hvhu8PTmM3tdiq0eO740aOBSpT6B Yd7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1720130815; x=1720735615; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=dFaYOWLt8is5D9As9aNtsr+qR/ekBHXt5qOy8aEh680=; b=w09gQmyuIASWAR0URoyT+TY0rLuEaUnHbM0kWw0g/gEEtmMk8n037t9VDAOIZKu3Jb Qrjue89jastIikFmGYCZ3FYUFm0QwgIb8QxmbbnOvGRZOqNv9aX4IZO83jNMAfz75P8u DXSXacpln1N2Q8s7JdRTw3HiBwXWhKEoM8Y5pxkToh1ZRCdON60j+zjjEltdSITD6zbp WuOACsanh56FFZhUr52RXB/DGR3DeUp8B3scMEsbVrq3eDJSOReZHZVW1uq9DRenA2wT TXgBDoWkXYlwb4Iq4FLwzwS0KlMcdzan53VAojL0ThyrIQL3o/7dnWTQU+csa0o+f8Z6 iJ1A== X-Forwarded-Encrypted: i=1; AJvYcCWAA835PexOc7tsDMQ2kg10D62n70RkYqg1j13fcSoM7tlBCkqkEqSI870pGK6uyZfg/9W+c4dS83ny8f33V2Qk21s= X-Gm-Message-State: AOJu0YzD8eOnlFpHsVsOVKsvWLzw2wyKrPeXoKJWtliHXnDCdw47G943 wI8HXfqSiWBG7u2u3zptCKGt98XiOrUXgTqwd5ReWbJhm9SKeF53eMF/i85xsTM= X-Google-Smtp-Source: AGHT+IEOXSukNyvdE753A9kN0wqOEG5BGZAWJFOPOuA3R3Nb5xT1OF4tfyv4M/ulUNm/JE9XRrkSIA== X-Received: by 2002:a05:6a20:842a:b0:1bd:feed:c031 with SMTP id adf61e73a8af0-1c0cc88ee9fmr3464693637.28.1720130814939; Thu, 04 Jul 2024 15:06:54 -0700 (PDT) Received: from dread.disaster.area (pa49-179-32-121.pa.nsw.optusnet.com.au. [49.179.32.121]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-72c6c9e1634sm10211352a12.58.2024.07.04.15.06.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 04 Jul 2024 15:06:54 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1sPUbL-004J02-0V; Fri, 05 Jul 2024 08:06:51 +1000 Date: Fri, 5 Jul 2024 08:06:51 +1000 From: Dave Chinner To: Matthew Wilcox Cc: Ryan Roberts , "Pankaj Raghav (Samsung)" , chandan.babu@oracle.com, djwong@kernel.org, brauner@kernel.org, akpm@linux-foundation.org, linux-kernel@vger.kernel.org, yang@os.amperecomputing.com, linux-mm@kvack.org, john.g.garry@oracle.com, linux-fsdevel@vger.kernel.org, hare@suse.de, p.raghav@samsung.com, mcgrof@kernel.org, gost.dev@samsung.com, cl@os.amperecomputing.com, linux-xfs@vger.kernel.org, hch@lst.de, Zi Yan Subject: Re: [PATCH v8 01/10] fs: Allow fine-grained control of folio sizes Message-ID: References: <20240625114420.719014-1-kernel@pankajraghav.com> <20240625114420.719014-2-kernel@pankajraghav.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 4100E180016 X-Stat-Signature: ehznaq1uyz4wrj87f837bff9ou1etb8n X-Rspam-User: X-HE-Tag: 1720130816-220743 X-HE-Meta: U2FsdGVkX1/7GJI7KtXIJ5MmPipjtx8luST0Qhd5SLJocSrCt6wYuZcwEi5XEJhKFQ3MKk98DEBg3XB7iqaYcdS2RAuIObzvHwTu+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CEBm1WInfih1hVM817pPKYeG1U6U+TNA8JY7O5ixEtUjoxjQsTojqBV0+5574CM5FlIG14CvmKKjWFWArrh7ERhwO3hcG5DiRZtnxzDePmQuO1Qe/lvaYO1gkbBQHoSSIuLpcoOhVd6nldoVWXLhkuU0/HoT41knqcoijH42gsj2NZm1k+k1F9WzN9OOZ/7gMGQalF+x97x4VL69k74Gt3ISNINs0Sxe1Tp2T0xNBU/KEFA3CBDUBuNz7Jq48tUyhS5GAOuHiURx+vbtY4= 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: List-Subscribe: List-Unsubscribe: On Thu, Jul 04, 2024 at 04:20:13PM +0100, Matthew Wilcox wrote: > On Thu, Jul 04, 2024 at 01:23:20PM +0100, Ryan Roberts wrote: > > > - AS_LARGE_FOLIO_SUPPORT = 6, > > > > nit: this removed enum is still referenced in a comment further down the file. > > Thanks. Pankaj, let me know if you want me to send you a patch or if > you'll do it directly. > > > > + /* Bits 16-25 are used for FOLIO_ORDER */ > > > + AS_FOLIO_ORDER_BITS = 5, > > > + AS_FOLIO_ORDER_MIN = 16, > > > + AS_FOLIO_ORDER_MAX = AS_FOLIO_ORDER_MIN + AS_FOLIO_ORDER_BITS, > > > > nit: These 3 new enums seem a bit odd. > > Yes, this is "too many helpful suggestions" syndrome. It made a lot > more sense originally. > > https://lore.kernel.org/linux-fsdevel/ZlUQcEaP3FDXpCge@dread.disaster.area/ > > > > +static inline void mapping_set_folio_order_range(struct address_space *mapping, > > > + unsigned int min, > > > + unsigned int max) > > > +{ > > > + if (!IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) > > > + return; > > > + > > > + if (min > MAX_PAGECACHE_ORDER) > > > + min = MAX_PAGECACHE_ORDER; > > > + if (max > MAX_PAGECACHE_ORDER) > > > + max = MAX_PAGECACHE_ORDER; > > > + if (max < min) > > > + max = min; > > > > It seems strange to silently clamp these? Presumably for the bs>ps usecase, > > whatever values are passed in are a hard requirement? So wouldn't want them to > > be silently reduced. (Especially given the recent change to reduce the size of > > MAX_PAGECACHE_ORDER to less then PMD size in some cases). > > Hm, yes. We should probably make this return an errno. Including > returning an errno for !IS_ENABLED() and min > 0. What are callers supposed to do with an error? In the case of setting up a newly allocated inode in XFS, the error would be returned in the middle of a transaction and so this failure would result in a filesystem shutdown. Regardless, the filesystem should never be passing min > MAX_PAGECACHE_ORDER any time soon for bs > ps configurations. block sizes go up to 64kB, which is a lot smaller than MAX_PAGECACHE_ORDER. IOWs, seeing min > MAX_PAGECACHE_ORDER is indicative of a severe bug, should be considered a fatal developer mistake and the kernel terminated immediately. Such mistakes should -never, ever- happen on productions systems. IOWs, this is a situation where we should assert or bug and kill the kernel immediately, or at minimum warn-on-once() and truncate the value and hope things don't get immediately worse. If we kill the kernel because min is out of range, the system will fail on the first inode instantiation on that filesystem. Filesystem developers should notice that sort of failure pretty quickly and realise they've done something that isn't currently supported... -Dave. -- Dave Chinner david@fromorbit.com