From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9D2571D63DF for ; Fri, 24 Jan 2025 06:53:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737701599; cv=none; b=Y5g4dh+MZQa7HimK4tphwJ2v81YOayHg8f0qReJnQv3zPpNMmkDGPVcHQ037oN3zXEONIhYLdQJSJyX0JT1+N97JxywsV/HVwVR08IY5xGAYrnCx4X6wrrv4G5SXCt50594PkyC6GTKUVVwY965KhmZ7vsxo39inhMFTZEW7Ou8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737701599; c=relaxed/simple; bh=SquPxaxN2LxzNqBYW9KvR5LRgVPLdyWaJrfRGxK7Uu8=; h=Date:From:To:cc:Subject:In-Reply-To:Message-ID:References: MIME-Version:Content-Type; b=ZZ44EyX/zognXgZ/FUgWjL5UaZvjmHj/pghOE7HwrC6zPLthDb8JxkJUpuKkKevbo46e59Tzk1c58LEbEnKNRIb7Kf7jH4vcEQCg3H0d2CYTU3w1nr/g/AH7d6ybFKViyfOKjBvhH0v9eIc0nL1vB8WuXlWCQKHOSMZC0Iam6T0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=xyRS/gwX; arc=none smtp.client-ip=209.85.210.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="xyRS/gwX" Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-7231e2ac9e4so487139a34.0 for ; Thu, 23 Jan 2025 22:53:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1737701596; x=1738306396; darn=vger.kernel.org; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to; bh=nDu0gStk+UNY++uqdvEB6rkJOYse4rTEWttgGcD9Cno=; b=xyRS/gwXAG4vrHj95YyKrCwQuHPJ0SYmiFMWDK9edI1heSAeMTITzH1fGELz2hutcW /1LN9sclqGxnyL4IuDdHazLQtdF3iuUV+UhVlPE16Iu8dgb/gf3Ej1BTPTdxLWI/wTJE +62NWosO/G7Z7/rTbHdNCgW6K29eXnzcYij6UqPzPYWbxb54nOSax2d6Z35nbmROBNtU wyEEqKZFqK36/DybyIULh6mvXw2AyMAtGjt7BI3yNwPPREJzcFW8MdR+g6SxbfK8afL7 q3keiBhX5RUEvMVbXGGo5phZR1xN4B8fNhxe54P7AgycwhiJY9DBEqxv7mqzRb0CG0DG NgYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1737701596; x=1738306396; h=mime-version:references:message-id:in-reply-to:subject:cc:to:from :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=nDu0gStk+UNY++uqdvEB6rkJOYse4rTEWttgGcD9Cno=; b=E/SlxJ6WufAzUnvlro4yVDM1TkuLeOjOLl39D+B2QpNpR2NHmE1ht4DfyfJUCfwZgs gv0CjdULumDaASA0HYIb8xYtGN9pmvt9njyF8d+JhxypIwiiHROfc59p2bbCSvt964WH LX73zVJBPqXrBo5N3h3KBxqVtYoHDxlAcK02H4tPwr2SjuOYZoB21KG7QU+rmLN4MHDG Oduzs/JA7ubIfRJ7+RLOMRYhF3MFDjFyPWAf8r1ZvuuWFbvSMz5ENar12NvaoSRqdt1r Cx5Eed2GREhzPq52UbrMnkZGYbddzqhxy9OpuoYDwK2HqOGka40P3NOeN2M9IjwV9BhB 441Q== X-Forwarded-Encrypted: i=1; AJvYcCXMOa8kYNvCFs7Ctv8KwMRJ6EOIzII4DIRG7X3G8AlDPPRT0CkJ2YxjVDM+PluMbKp7MmUoGZBhf13wSNI=@vger.kernel.org X-Gm-Message-State: AOJu0YydWQW+OT9CaUCA/Q5HuDDVqvobC52+1Py9h5VXDlLsoFv6zMwx 2K0nsV6qyRON5d9anmQehWzzZcNkzAwUHl81zaHnc3Mti69t9gsE0CjPC07ZtA== X-Gm-Gg: ASbGncstCb9sD3SotiCZqUKIs4nERccdRVxU2C/HhT4RWDS2I91eG29v5DpzHtR+5OF gWDDLwjCpbcmE9PAchFaKCcaercRvPOxovv9NtQn8lgHwuODbPflTBfEBwxwbiqpD4uUvemz1v4 i3fPoSj95RZG8wjKPz9D3j8dcfofPg+iw26n3KnUOCP1XzG0R7dwMD9mhLFTRNcRg6gN3D/JjAK FjfCozTX2JxuPInQOzknG7pmiFOAhHj/RW8LW0mf6BKaMGLUoPt045KbUjVdFYfTiBSjGp3tFtF U5uFYGSThwlwCcqpjryQgqhSwlhArv9tiy1OK9FfwyLCvTvRy8YGYLC2orGaw8Kj X-Google-Smtp-Source: AGHT+IHAVDCUsF/BfZaOV9tq6XtbZ0z0JpadpK/l9o7VaS3dn9pmnpZqyXMEM6eyWzf78l/g0LwiQw== X-Received: by 2002:a05:6830:6404:b0:71e:1fbe:db2a with SMTP id 46e09a7af769-7249da712e3mr19318325a34.12.1737701596499; Thu, 23 Jan 2025 22:53:16 -0800 (PST) Received: from darker.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-724ecdbc95fsm319107a34.18.2025.01.23.22.53.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Jan 2025 22:53:15 -0800 (PST) Date: Thu, 23 Jan 2025 22:53:04 -0800 (PST) From: Hugh Dickins To: Johannes Weiner cc: Andrew Morton , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mm: memcontrol: move memsw charge callbacks to v1 In-Reply-To: <20250124054132.45643-1-hannes@cmpxchg.org> Message-ID: References: <20250124054132.45643-1-hannes@cmpxchg.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII On Fri, 24 Jan 2025, Johannes Weiner wrote: > The interweaving of two entirely different swap accounting strategies > has been one of the more confusing parts of the memcg code. Split out > the v1 code to clarify the implementation and a handful of callsites, > and to avoid building the v1 bits when !CONFIG_MEMCG_V1. > > text data bss dec hex filename > 39253 6446 4160 49859 c2c3 mm/memcontrol.o.old > 38877 6382 4160 49419 c10b mm/memcontrol.o > > Signed-off-by: Johannes Weiner I'm not really looking at this, but want to chime in that I found the memcg1 swap stuff in mm/memcontrol.c, not in mm/memcontrol-v1.c, very misleading when I was doing the folio_unqueue_deferred_split() business: so, without looking into the details of it, strongly approve of the direction you're taking here - thank you. But thought you could go even further, given that static inline bool do_memsw_account(void) { return !cgroup_subsys_on_dfl(memory_cgrp_subsys); } I thought that amounted to do_memsw_account iff memcg_v1; but I never did grasp cgroup_subsys_on_dfl very well, so ignore me if I'm making no sense to you. Hugh