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 10FA4C71136 for ; Thu, 12 Jun 2025 20:08:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CD146B0088; Thu, 12 Jun 2025 16:08:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 67D546B0089; Thu, 12 Jun 2025 16:08:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 56EC06B008A; Thu, 12 Jun 2025 16:08:23 -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 3699D6B0088 for ; Thu, 12 Jun 2025 16:08:23 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 999F9101232 for ; Thu, 12 Jun 2025 20:08:22 +0000 (UTC) X-FDA: 83547835644.13.769C3B6 Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) by imf27.hostedemail.com (Postfix) with ESMTP id B8D6340004 for ; Thu, 12 Jun 2025 20:08:20 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=dpimJea+; spf=pass (imf27.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.219.52 as permitted sender) smtp.mailfrom=nphamcs@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1749758900; 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=DiHz98Mxk+xvT9nSZ/1QhqW5iHTXOqSdDvRykpRGgyc=; b=YSDrIuHh7a4JkN2XMZtWu02Gitwv9oXNixmdqyGFnyVT8Ibm/MIOU8QPlLoHGfscqc/vbD InQfZEtuUXS75V6Qb/TGonbGokVre6cuiDZK1Nf6r1zW7vY8OzYWo1GOPrW8hSmowx61ct NUsOz89inj+OdRfzUcqt1a9WKxDxs0A= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1749758900; a=rsa-sha256; cv=none; b=0XDaZSmji+N+lxcA9qepmP9g6Y6UBwYLm8EvtNv05zM+gkK3FGxJv2RGe0iUPcy6zpxV3v HzFZNicDl9fVsVvIuBYcMd9AGoKCxHxV1zyrpN3bqH3kBwmXOKrgCfBiIqLruv8rmF7eEG F//Esm6/h1wEPYZ1ixt2e8ebkyXuPzs= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=dpimJea+; spf=pass (imf27.hostedemail.com: domain of nphamcs@gmail.com designates 209.85.219.52 as permitted sender) smtp.mailfrom=nphamcs@gmail.com; dmarc=pass (policy=none) header.from=gmail.com Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-6f0ad74483fso15681566d6.1 for ; Thu, 12 Jun 2025 13:08:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1749758900; x=1750363700; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DiHz98Mxk+xvT9nSZ/1QhqW5iHTXOqSdDvRykpRGgyc=; b=dpimJea+4ypyUQD6hMOxxyOxibpP9FpiDUKMaRODmx6ZKoUavReQj+fYDnz5zn+5gL XSA3LBbH/FdmsdcGPQTl+WU5Yzge0boxpZIvwJQTCM8EgBFNVsndNf8/4gimtoM7i/z6 zkfluuI1cYYxrSq4iDq/3f1U8vS5ooPH9Xe46RhjJFud7EwoUWvY+qvG/UCRNv65tcHH EvU7yagmmbFv3P9ukxBZsL7YgAGeVUHNvESjiw/q4yhXU32G5CD+axD2KMn8ygwW8qkT llX372MoA8IuRYUvYAzTwq2QUeYdjiswR2yDWc/H7gF0AzwWrfD9RHbIGOLMzjPDe2Dw R9qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1749758900; x=1750363700; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DiHz98Mxk+xvT9nSZ/1QhqW5iHTXOqSdDvRykpRGgyc=; b=K2hEK4IYRPoglTOvFPTFfLUKrkeeuwUCejXhbCVtriZ23RnVT2r1U1DVQvRu0JJCWG Nl8T50yt7IS/uASYmhwco+gvzL+9umtOpSSx2iQk8uhhHIz1tMpQB5ZGj5+mZ8tN69ic E4eLRTg8itbVWc5Va89Rk9X1Ug8qFrjR/iJ+ng4sZO0oDil7K7iJHbRZMvukmwkeBcNR HHHbeXCXXm7MNOgCi/SKzxNgORbwBiHVVh4Jx0RaFyoP1N4LTGpb4dAB3hBkRhN7rc9Z Zyst6f+AeksFNqCICmNBXoNhm7uaA1UfO8VhWJYQvVGkqcuLNKmEVfUEuGMLs9PgBP5g rwbA== X-Forwarded-Encrypted: i=1; AJvYcCWjplTHpw7zdya6OAJivGHz+SNWDF3peHJx8OPCmLaP8kmmSbtAVs9MrsZ77izXZokh5eng8yBMVA==@kvack.org X-Gm-Message-State: AOJu0YzbTc9A0YGBp3Yl99v7DgZFFq8QWGQPkbgTzDz6l7o8OAuaUNes X1SV9JgFpz1EcI6pHUkrfWeZBIEWP5rmO1EKeVZ7KDKzg9Rg7QFYLGcdzPG2YxJ+AWGX+c5dCpf eJXrK6MXulo0wKRWQA+FAN2ATNu4REKM= X-Gm-Gg: ASbGncuwLOjLXZbGWnlTjQSZTtF3DnsWlIf5ixcW84X0GSZVEv5H2VY8nlS63tPHbsT TprBcbky49GPfV5Lw2iaIH081d28Wxu1IrYbWzVGILDvBSpS+WUfiwmScZiwX2A5jGv+DWii32U NSOMuQ8NWM+evNnOKCZrE3Y29mZL+dAoupZw8LvAdIGNlXbRY2+a+SMc67f1Y= X-Google-Smtp-Source: AGHT+IEgTPBLzBNJnVH9ZaUwKb5JS2x+1tjyT6kY3nP+PXMGesmHoi/z8hyu7vCxT4zfKCaPEPsY83F+n+zgiAUDO1I= X-Received: by 2002:a05:6214:19e5:b0:6f8:d223:3c32 with SMTP id 6a1803df08f44-6fb3e59bddemr3411996d6.10.1749758899634; Thu, 12 Jun 2025 13:08:19 -0700 (PDT) MIME-Version: 1.0 References: <20250612103743.3385842-1-youngjun.park@lge.com> <20250612103743.3385842-3-youngjun.park@lge.com> In-Reply-To: From: Nhat Pham Date: Thu, 12 Jun 2025 13:08:08 -0700 X-Gm-Features: AX0GCFstYwQPkydoxcIP3F_wXZqsbH2ZywGwO5bQiBiteJh5tFlf_0yxP0yKGKw Message-ID: Subject: Re: [RFC PATCH 2/2] mm: swap: apply per cgroup swap priority mechansim on swap layer To: Kairui Song Cc: youngjun.park@lge.com, linux-mm@kvack.org, akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org, roman.gushchin@linux.dev, shakeel.butt@linux.dev, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, shikemeng@huaweicloud.com, bhe@redhat.com, baohua@kernel.org, chrisl@kernel.org, muchun.song@linux.dev, iamjoonsoo.kim@lge.com, taejoon.song@lge.com, gunho.lee@lge.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: B8D6340004 X-Stat-Signature: gmixwwjhdrp54y93gwu7f7ry78tfpuw5 X-HE-Tag: 1749758900-610936 X-HE-Meta: U2FsdGVkX1+fECy1zkg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fVeyxnwJYMYrnGZr9ZPBQWSvmR4mww9JTMoqxhZpyVRNjZUpFYlZrv4spp5lH8x+C1CniHnwnoSnJ0G3Oxyq33h2cbKQMEC+s8V4PwYzpU0J9eU5OM790X1wVuU6uk/pTZDujubeoDYdgP7ZmvpAkY0sow9tknK7N/UonLPoRlyWfBWtAxugWqBOV6onPo4mOnMdS4EOO1P7fJheps8a7s1euXxMBPEtAolQT2AQmT59KbYPoFt25u+qVJqxSRYkY8A== 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, Jun 12, 2025 at 11:20=E2=80=AFAM Kairui Song wro= te: > > On Fri, Jun 13, 2025 at 1:28=E2=80=AFAM Nhat Pham wro= te: > > > > On Thu, Jun 12, 2025 at 4:14=E2=80=AFAM Kairui Song = wrote: > > > > > > On Thu, Jun 12, 2025 at 6:43=E2=80=AFPM wrote= : > > > > > > > > From: "youngjun.park" > > > > > > > > > > Hi, Youngjun, > > > > > > Thanks for sharing this series. > > > > > > > This patch implements swap device selection and swap on/off propaga= tion > > > > when a cgroup-specific swap priority is set. > > > > > > > > There is one workaround to this implementation as follows. > > > > Current per-cpu swap cluster enforces swap device selection based s= olely > > > > on CPU locality, overriding the swap cgroup's configured priorities= . > > > > > > I've been thinking about this, we can switch to a per-cgroup-per-cpu > > > next cluster selector, the problem with current code is that swap > > > > What about per-cpu-per-order-per-swap-device :-? Number of swap > > devices is gonna be smaller than number of cgroups, right? > > Hi Nhat, > > The problem is per cgroup makes more sense (I was suggested to use > cgroup level locality at the very beginning of the implementation of > the allocator in the mail list, but it was hard to do so at that > time), for container environments, a cgroup is a container that runs > one type of workload, so it has its own locality. Things like systemd > also organize different desktop workloads into cgroups. The whole > point is about cgroup. Yeah I know what cgroup represents. Which is why I mentioned in the next paragraph that are still making decisions based per-cgroup - we just organize the per-cpu cache based on swap devices. This way, two cgroups with similar/same priority list can share the clusters, for each swapfile, in each CPU. There will be a lot less duplication and overhead. And two cgroups with different priority lists won't interfere with each other, since they'll target different swapfiles. Unless we want to nudge the swapfiles/clusters to be self-partitioned among the cgroups? :) IOW, each cluster contains pages mostly from a single cgroup (with some stranglers mixed in). I suppose that will be very useful for swap on rotational drives where read contiguity is imperative, but not sure about other backends :-? Anyway, no strong opinions to be completely honest :) Was just throwing out some ideas. Per-cgroup-per-cpu-per-order sounds good to me too, if it's easy to do.