From patchwork Fri Oct 25 01:23:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shakeel Butt X-Patchwork-Id: 13849921 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 6A815D1038E for ; Fri, 25 Oct 2024 01:23:48 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F02956B00A4; Thu, 24 Oct 2024 21:23:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB2336B00A5; Thu, 24 Oct 2024 21:23:47 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D7B706B00A6; Thu, 24 Oct 2024 21:23:47 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id B80CE6B00A4 for ; Thu, 24 Oct 2024 21:23:47 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id C4475A02FB for ; Fri, 25 Oct 2024 01:23:12 +0000 (UTC) X-FDA: 82710377274.16.311A253 Received: from out-172.mta0.migadu.com (out-172.mta0.migadu.com [91.218.175.172]) by imf11.hostedemail.com (Postfix) with ESMTP id 8A5004001A for ; Fri, 25 Oct 2024 01:23:22 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=GrsC3TDa; spf=pass (imf11.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.172 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729819271; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=iejBIQWD2OAhZkVfaU63yScFrNJ6h4kxppqkG7YGNik=; b=AVWXLeQzZC9Q7YMrykiLRy5JtGuDLlKkDVkkWsGyAMenjGlYNOAmsdheOSYP8aVVFXai7q rueq3XM6xKnQ+upg+k2Qteo0jZsaJ79xQRW8zXpgy0aR1kNQbidwEvidxq+pbbu/ehR4Jl pCFVx1ELJRSs1djAI1RSuVxlGY1bdso= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729819271; a=rsa-sha256; cv=none; b=Qg3XAB9nCeDAqhdjO93vcddcdgI0HNRM3RVXX2oc4JrR6jj7bjdAYp0sndN5eHh4pWyxqu Y7dscKzfbzYRzgQ4vHJ6AdoclfqGxweea59Q+fR6PYowaoc/eyDTo1hdCGAHEBZruMRJCd rBjnubGQe9oMe6qXsBcGGJlBxeepvgo= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=GrsC3TDa; spf=pass (imf11.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.172 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1729819424; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=iejBIQWD2OAhZkVfaU63yScFrNJ6h4kxppqkG7YGNik=; b=GrsC3TDaVDfYh+TUdZFQPVmDb83cgTuYqF7TK1rwrc6JkwUX3NwN47+8aVi9qNqpCYg9I5 oYRZ+6lJYSOJw+Zsn2rtkf6E3JCqoEbsRETnHxv6dd9lUBtB1tqCkB80WWWonbPuzHynDI kNuvqZMBg1LZe3LcBjV/jtUeMaZu/ig= From: Shakeel Butt To: Andrew Morton Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Hugh Dickins , Yosry Ahmed , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-doc@vger.kernel.org, Meta kernel team Subject: [PATCH v1 5/6] memcg-v1: no need for memcg locking for MGLRU Date: Thu, 24 Oct 2024 18:23:02 -0700 Message-ID: <20241025012304.2473312-6-shakeel.butt@linux.dev> In-Reply-To: <20241025012304.2473312-1-shakeel.butt@linux.dev> References: <20241025012304.2473312-1-shakeel.butt@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-Stat-Signature: mhfab1wfmb5wiwszteq5zmk39nn1jo94 X-Rspamd-Queue-Id: 8A5004001A X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1729819402-998688 X-HE-Meta: U2FsdGVkX1/Lg9lXYK3v6UHv2wPByNmoZ6ODt7g5MeDa3gB1LbbEQjwueyImOL09GnX3fDuiqSDyziTAJmdYS3nCb6WWb9oi9D7/YycnDn0prtR3CaTCSgB7PUqHkHoe9ds+ezRhQVn0fSUZyqjCviJVq3CeeJM/qrlL1t9tb5lLTJSBSt+HUk+5ymxDsOnBh50Tv3UJnLlxpx+kQokzVxgZ0MD9NFBr2OzMIkZuirnJw+oVb7FT5BIUyURPfA6rWagQdd/l410H26EX1AeHrJcAVLI1DmhewHORDIu602vm0XUd8ZTlufVZ9ibJnqEQWlSJe3I3Ga78DaZ/HoUAgSFd26E4obzgmYybnt33cTkJ48ssKqJHp1ySIvyko5imQRhljYGhXpUIshwokkzxB3OxzSmEE4UprG0i5R6eB5UfjoC2QA6c0whasJb3IFEsW0OHaUcZtT5QC9BCJHSjDClK/H3Iu7IaaYHsGW22rgCcUobpbZjev7L8upyF/5dyH/SHWXpFhYTgztb9VUrRDwcygLnjXBh1QX3b+LNZeP3Ek1cdDhhC4v5/MeaKwwrEjNcymBexi89VAYROR3K2/f2PTWh69QvFIx6x9zl4vRTMk8Fym5tlPuw0nTCpbAi39AEbC0JC7x41uaQJOSdBasJimPRQh6hy1LMBKTTaqs+CS+Mi+zYgB1EcqVZ/51UkH4pDmmYFMKsakPgqi5W1YfJ1SwTsRE647k2lT1yc6+b3xaW9YdK7qJAS8Reu95hEX9UR3bXBom4w8OBg/rMqVSo6eq+JYcjR3merslcjb8ELBYNbUWUX6K3b6kRTKfGgrJ8arrG32T0W4GqZCc3GExxVoYrOWX7tTuyEY4X2jABTzROkirncpASpnGgXNu7MC73V92Bb9/4Wpyp36Za4rzO0zciN7YWyIy/6whYoDrmZkY0dpv9DmYM1vleazpeDb7MrNezAC8nUhi/oYr7 f8Zplac3 PW2zg5rjIONWlLlPqVSjfdpTCL+YO1y5x2XF6Q23yS7VfedI0n+9TzMLUPLYdiOysti3q7rBGW+OzFwmIwSbs+zp+G/xLW3fitX4uD+rH1SJZOQvr5wgrpgwnoYbLOUgXLFJi9HSfnC++UhM= 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: While updating the generation of the folios, MGLRU requires that the folio's memcg association remains stable. With the charge migration deprecated, there is no need for MGLRU to acquire locks to keep the folio and memcg association stable. Signed-off-by: Shakeel Butt Reviewed-by: Roman Gushchin --- mm/vmscan.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 29c098790b01..fd7171658b63 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -3662,10 +3662,6 @@ static void walk_mm(struct mm_struct *mm, struct lru_gen_mm_walk *walk) if (walk->seq != max_seq) break; - /* folio_update_gen() requires stable folio_memcg() */ - if (!mem_cgroup_trylock_pages(memcg)) - break; - /* the caller might be holding the lock for write */ if (mmap_read_trylock(mm)) { err = walk_page_range(mm, walk->next_addr, ULONG_MAX, &mm_walk_ops, walk); @@ -3673,8 +3669,6 @@ static void walk_mm(struct mm_struct *mm, struct lru_gen_mm_walk *walk) mmap_read_unlock(mm); } - mem_cgroup_unlock_pages(); - if (walk->batched) { spin_lock_irq(&lruvec->lru_lock); reset_batch_size(walk); @@ -4096,10 +4090,6 @@ bool lru_gen_look_around(struct page_vma_mapped_walk *pvmw) } } - /* folio_update_gen() requires stable folio_memcg() */ - if (!mem_cgroup_trylock_pages(memcg)) - return true; - arch_enter_lazy_mmu_mode(); pte -= (addr - start) / PAGE_SIZE; @@ -4144,7 +4134,6 @@ bool lru_gen_look_around(struct page_vma_mapped_walk *pvmw) } arch_leave_lazy_mmu_mode(); - mem_cgroup_unlock_pages(); /* feedback from rmap walkers to page table walkers */ if (mm_state && suitable_to_scan(i, young))