From patchwork Wed Jul 10 01:07:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qu Wenruo X-Patchwork-Id: 13728756 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 361A4C2BD09 for ; Wed, 10 Jul 2024 01:08:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9967C6B0083; Tue, 9 Jul 2024 21:08:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 946AF6B0085; Tue, 9 Jul 2024 21:08:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 80F446B0092; Tue, 9 Jul 2024 21:08:19 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 632016B0083 for ; Tue, 9 Jul 2024 21:08:19 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 87478A14EF for ; Wed, 10 Jul 2024 01:08:18 +0000 (UTC) X-FDA: 82322057076.05.29BFCB8 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf04.hostedemail.com (Postfix) with ESMTP id 89E3A40002 for ; Wed, 10 Jul 2024 01:08:16 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=AkbhUu+B; dkim=pass header.d=suse.com header.s=susede1 header.b=AkbhUu+B; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf04.hostedemail.com: domain of wqu@suse.com designates 195.135.223.131 as permitted sender) smtp.mailfrom=wqu@suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1720573673; a=rsa-sha256; cv=none; b=lAjJ6FGATxiUxpwJ4Rf8F38YC/n5b77riHOUx51PBmxzEq9gwxshv952h9irpJN2cZ4S96 b7Lv/isxMjepG5Xsyy1FANbSk1SRXiVct5nOqt1KXpcBaZYN3qzOM4xaHrxbrX65ZhjbFV +dFiUcV0ZlP8UecL3ckGldMZF8v5MYM= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=AkbhUu+B; dkim=pass header.d=suse.com header.s=susede1 header.b=AkbhUu+B; dmarc=pass (policy=quarantine) header.from=suse.com; spf=pass (imf04.hostedemail.com: domain of wqu@suse.com designates 195.135.223.131 as permitted sender) smtp.mailfrom=wqu@suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1720573673; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version:content-type: content-transfer-encoding:content-transfer-encoding:in-reply-to: references:dkim-signature; bh=LRJjtkA62dGtzTYeDaCxrJybyaUrrk/lLoMPFfZZfoQ=; b=P+Ob4VMmv1D8bsxrY9F3reanuW/VE7GYCSdVgjjqFexp8lU51mZz1yuqw35IWmt34Nl2IL Xw5uigBG88AHrOZOxJ0tvZCQaS5LJBo1OChe9nav5mXhIxvV3sRSWK/YywPOHlNJYN3Qom cveSu9sDafhhebmAF2nqEJ4vkXymjpI= 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 1160E1F7CD; Wed, 10 Jul 2024 01:08:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1720573695; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=LRJjtkA62dGtzTYeDaCxrJybyaUrrk/lLoMPFfZZfoQ=; b=AkbhUu+BKFSzNPbx90M25I0+GFHv+loJxIYmyEAjWmnOIS5qyBDPxMllkYCxgTd9DcPFHv 7uV4ePvpcSHa9+Di6IalB4Y0ondwcKKP/nrb7Mmv+7d4wbfvjL2ThmkdhlsRHJSHI/xhWC 9RTBowROwH3YXk36CGlJjqtOjsjr/Iw= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1720573695; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=LRJjtkA62dGtzTYeDaCxrJybyaUrrk/lLoMPFfZZfoQ=; b=AkbhUu+BKFSzNPbx90M25I0+GFHv+loJxIYmyEAjWmnOIS5qyBDPxMllkYCxgTd9DcPFHv 7uV4ePvpcSHa9+Di6IalB4Y0ondwcKKP/nrb7Mmv+7d4wbfvjL2ThmkdhlsRHJSHI/xhWC 9RTBowROwH3YXk36CGlJjqtOjsjr/Iw= 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 978D41369A; Wed, 10 Jul 2024 01:08:13 +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 LinKE/3ejWaYTQAAD6G6ig (envelope-from ); Wed, 10 Jul 2024 01:08:13 +0000 From: Qu Wenruo To: linux-btrfs@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 0/2] mm: skip memcg for certain address space Date: Wed, 10 Jul 2024 10:37:45 +0930 Message-ID: X-Mailer: git-send-email 2.45.2 MIME-Version: 1.0 X-Rspamd-Queue-Id: 89E3A40002 X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: h7r69yu97d8d7xfr5jo5onqgx38m9y9w X-HE-Tag: 1720573696-183311 X-HE-Meta: U2FsdGVkX1/0uJo9zbqkrn9zjrE0u+4UzAGF0pkb1vu+k1YNgk0G6K3d5wKMrKTw1umriL77G4ya+8as8R+w2qpa/YARt89j5W3TpREWDSy1JyvGlNOK5y7gfbN65yy3h61ygFCOBteDH389jhu/1NywUxHlmnnLgXDSog5rbyjjBiEXehIKFExYt59Ph15xdx6ti2yWC+uv9AL8ftGd5vmMp3/MOPhioZPTgrLE9p0bWvgvT6Wcqfzc9E+3kteTb14snUVaAzmEwwMdiet/YNCZ/lSMFyi48LXXysJkWBlWPVZr27cb47anYFZz03qObNM8jnZ7PjrmVlsYdfmBt74279NSqfg32onw7yMpg4QJgKt86DiMLKmN2avBZp/tqhzwzZQz80o0KrQbwhu2nGreqIg5ZrStDsw+FLdkKzf7xadcnofII5c3wcBEh3/Y10imHJ3WuZZKoBkgJGqQkw4Se1V8Q/vRRYousIHoygHyz9tqKS7arg0YbTX/z5GE0pGowXuQ6ivU/eDvHVCXwxqEy8ialLgHAkWeWe9jh+68NtOdh7gyIwinERxwIf+qIksZeQ3EMwELq5I0d0u9UEWfV3LhXT0uf9FLxtcr2XVvJZr649KqZRSm7+HujpON5XJH1g6fpJJ673M6Wa/phFO9Fv3IdDfNUrUg9jFtEStXszC31RvJr9hY8PKcX4zedScHeu+VLZbma5VKyjZBNp+c0MKK5JmoddokRcMKYw0dZCJYq39f72YmJazTWXzJg7MbWnOPV2RhAsV1iENqOSDsGTbvnNjJpibmZZ3RreqinyiWJAx6p+fIO0cw6ziWq343lTKXilIqHv+pmThI92USQafWYwFwfdPpjhCiqnZiqrIAO5FftXHEipYzsXcbc6RNPUzoKrYOcJGzhTGJzGaF45PVLMKss5KDT3StsEtDllMWMmzxv/bwABLE+IoTOQXN/3z+SQ1UIV/Unlp Al3Mjhi2 DrwWxray3QYNEJvCP4b615OrV8Agc+zGtk7gQhTd1SBlNoMoLMUHfCSI7q5J+8kA84yH9hmQY7IR4aPtgdmIRo5q1Tr5vA4KB7jD8WiJO2DVE8oMO7rCPnQ8AfeJsrrrmgOCGKriVmLz2Va1un/ZiufqWefS/gRLgL5RT+mHWesO02PtAZBwgwmIxu6F5zatIxnksL5oGD0zorYE= 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: Recently I'm hitting soft lockup if adding an order 2 folio to a filemap using GFP_NOFS | __GFP_NOFAIL. The softlockup happens at memcg charge code, and I guess that's exactly what __GFP_NOFAIL is expected to do, wait indefinitely until the request can be met. On the other hand, if we do not use __GFP_NOFAIL, we can be limited by memcg at a lot of critical location, and lead to unnecessary transaction abort just due to memcg limit. However for that specific btrfs call site, there is really no need charge the memcg, as that address space belongs to btree inode, which is not accessible to any end user, and that btree inode is a shared pool for all metadata of a btrfs. So this patchset introduces a new address space flag, AS_NO_MEMCG, so that folios added to that address space will not trigger any memcg charge. This would be the basis for future btrfs changes, like removing __GFP_NOFAIL completely and larger metadata folios. Qu Wenruo (2): mm: make lru_gen_eviction() to handle folios without memcg info mm: allow certain address space to be not accounted by memcg fs/btrfs/disk-io.c | 1 + include/linux/pagemap.h | 1 + mm/filemap.c | 12 +++++++++--- mm/workingset.c | 2 +- 4 files changed, 12 insertions(+), 4 deletions(-)