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 88F18CA1003 for ; Fri, 30 Aug 2024 15:25:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 281F56B0176; Fri, 30 Aug 2024 11:25:44 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2314B6B0177; Fri, 30 Aug 2024 11:25:44 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0D2286B0178; Fri, 30 Aug 2024 11:25:44 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id E24ED6B0176 for ; Fri, 30 Aug 2024 11:25:43 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 92AF91C4E8E for ; Fri, 30 Aug 2024 15:25:43 +0000 (UTC) X-FDA: 82509286566.20.FCAD113 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf18.hostedemail.com (Postfix) with ESMTP id 3BD271C001E for ; Fri, 30 Aug 2024 15:25:40 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="PjJ/GGJz"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="R/iTWHJh"; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="b3LaU4/L"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=kVhVRxbY; dmarc=none; spf=pass (imf18.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725031441; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=XWnzRDtYyiKw4+/tQoF82vYW5iToq0BDKNejq3/tEfI=; b=ikN61c0WIWOcRqbuWN0VMpV9XkG6dVG1AhQbbCTtREk0naorH7cVVjae1c+FX7ZPjI/7yG 2KgVpcEWPDSvGGVzdlTRQ6+YzKiER+DXdmRQ2ELbU17n2K9MKsmSwEd3v8k4AvDScI4Aj4 4m3jYTTPv83YtULjbdKhQdOuEGLm+6Q= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725031441; a=rsa-sha256; cv=none; b=qjsr8yh1PQo3ss8UEI8vSGIrpgozTqjT6aXo3Nb0tox27T3hfUgT1Y4kCOxpPkdZIRc6b4 BWI1DlKB2h3xXicn/kIGe3jKGaBKnXRy/pAXbJUZbRTAH7vi+00OV2BhnApUeydRukvJC6 y1J/lOxKhYW7qsb2qnp88U8x3tbGIBM= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="PjJ/GGJz"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b="R/iTWHJh"; dkim=pass header.d=suse.cz header.s=susede2_rsa header.b="b3LaU4/L"; dkim=pass header.d=suse.cz header.s=susede2_ed25519 header.b=kVhVRxbY; dmarc=none; spf=pass (imf18.hostedemail.com: domain of vbabka@suse.cz designates 195.135.223.131 as permitted sender) smtp.mailfrom=vbabka@suse.cz Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3E5831F7D7; Fri, 30 Aug 2024 15:25:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1725031539; h=from:from:reply-to: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=XWnzRDtYyiKw4+/tQoF82vYW5iToq0BDKNejq3/tEfI=; b=PjJ/GGJz/HPNIwxTYmQLnQVqQhnIPSG5hlOD15O3/cEExasyt6JbkegPLNQ0fbj5WSw+CA eq1IuQ13AFR/ZTev6jiyB9ka2u9/5wE+C05Vj6+Km5UkBQ8PZrFMqGRbvTyKJpBG8UGEQ7 GvCgHC6Ned/EgsVo/g47UCNnQGTRCE0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1725031539; h=from:from:reply-to: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=XWnzRDtYyiKw4+/tQoF82vYW5iToq0BDKNejq3/tEfI=; b=R/iTWHJhvXOWOm35QXFdoQpgreMc3S3+OkDUaQofGb/WV0ZFjE9srlc4cmqFZwOHvbEb4+ 9ed+5RAwYGom3pBQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1725031538; h=from:from:reply-to: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=XWnzRDtYyiKw4+/tQoF82vYW5iToq0BDKNejq3/tEfI=; b=b3LaU4/LNz2Ztgx6PoNo9qffokU3etG2y3fudDe+hX+OCc67YBzyQllbrGViRips59msZa DHJVxMosYBjjnlQlnapOJS4DPBryhJeq1X4lLqkVVDGjJHyrAirM81Sn6Z8J88uwvB5+Jm jTaV/UiHtK4IpyWY0016sQObLswCrlQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1725031538; h=from:from:reply-to: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=XWnzRDtYyiKw4+/tQoF82vYW5iToq0BDKNejq3/tEfI=; b=kVhVRxbY+uTv1eXdfW7326R2MlZWqBxgd9tjLG1jLWYqGVysANrvajdy953rh0Lil5O97a JAMAWHQD5V5JSnBA== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 24D0A13A3D; Fri, 30 Aug 2024 15:25:38 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Dx0vCHLk0WZ+ewAAD6G6ig (envelope-from ); Fri, 30 Aug 2024 15:25:38 +0000 Message-ID: Date: Fri, 30 Aug 2024 17:25:37 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] bcachefs: Switch to memalloc_flags_do() for vmalloc allocations Content-Language: en-US To: Yafang Shao , Dave Chinner Cc: Kent Overstreet , Michal Hocko , Matthew Wilcox , linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Dave Chinner References: <20240828140638.3204253-1-kent.overstreet@linux.dev> From: Vlastimil Babka In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 3BD271C001E X-Stat-Signature: cttdc5qawcicocxbo6qzrbthn8z3h1b4 X-Rspam-User: X-HE-Tag: 1725031540-649104 X-HE-Meta: U2FsdGVkX18Ri61ohfb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qu6f3c7TkrveLkdPvpdeLPClKNRs9O0LWo5A12ZKhIck7k2yI5YV50gjiDTTXOIetWghCvTqcOrKMmA/vAOQDRNZQvtnhlu/ZrdD25ySVmz/BjEfX1hgBiLp+vTfEKkRkw3jxC/Cwyyg4rr0+ePZoN0XIq+5cZyKE/XRzSqbeB1D43gQVVwFpLfkPcAjuL32qdbz7cVmm7P727PpkriMfzE8skJg9PX3/ckyRmPDkFeFPx3KsIf6eqNd72WvW22OvJ5x6oQfjNgRga4RmbG4L/A/Gh8qO9P0uqjolXvvU4J8qlp/E6K5t+IdLE36MT4TVN096hGo8a6XTF/C220Fam63qPtK0dJ4wL6ae20it80/h8TIC6r5T2tZuGF1JjuDgc10= X-Bogosity: Ham, tests=bogofilter, spamicity=0.003428, 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 8/30/24 11:14, Yafang Shao wrote: > On Thu, Aug 29, 2024 at 10:29 PM Dave Chinner wrote: > > Hello Dave, > > I've noticed that XFS has increasingly replaced kmem_alloc() with > __GFP_NOFAIL. For example, in kernel 4.19.y, there are 0 instances of > __GFP_NOFAIL under fs/xfs, but in kernel 6.1.y, there are 41 > occurrences. In kmem_alloc(), there's an explicit > memalloc_retry_wait() to throttle the allocator under heavy memory > pressure, which aligns with your filesystem design. However, using > __GFP_NOFAIL removes this throttling mechanism, potentially causing > issues when the system is under heavy memory load. I'm concerned that > this shift might not be a beneficial trend. > > We have been using XFS for our big data servers for years, and it has > consistently performed well with older kernels like 4.19.y. However, > after upgrading all our servers from 4.19.y to 6.1.y over the past two > years, we have frequently encountered livelock issues caused by memory > exhaustion. To mitigate this, we've had to limit the RSS of > applications, which isn't an ideal solution and represents a worrying > trend. By "livelock issues caused by memory exhaustion" you mean the long-standing infamous issue that the system might become thrashing for the remaining small amount of page cache, and anonymous memory being swapped out/in, instead of issuing OOM, because there's always just enough progress of the reclaim to keep going, but the system isn't basically doing anything else? I think that's related to near-exhausted memory by userspace, so I'm not sure why XFS would be to blame here. That said, if memalloc_retry_wait() is indeed a useful mechanism, maybe we could perform it inside the page allocator itself for __GFP_NOFAIL?