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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA23FC636D3 for ; Mon, 6 Feb 2023 22:40:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229791AbjBFWj7 (ORCPT ); Mon, 6 Feb 2023 17:39:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54762 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229640AbjBFWj4 (ORCPT ); Mon, 6 Feb 2023 17:39:56 -0500 Received: from mail-ej1-x62e.google.com (mail-ej1-x62e.google.com [IPv6:2a00:1450:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E43B72FCEA for ; Mon, 6 Feb 2023 14:39:55 -0800 (PST) Received: by mail-ej1-x62e.google.com with SMTP id hr39so9004193ejc.7 for ; Mon, 06 Feb 2023 14:39:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=vBYiMptRxwrwyAIJqR0DNTAcDHviyisXsjkfb23ttq0=; b=pYHUFJ0huOMCZRpFmAWdIqONn14zA0VKbs7NoBaHhiULeZuC89C4qTp2OSmh6X976F yVcFimguUqPFHl/SznKsQVSmGwZRfLdQMKYJzZEqkjTtedvKDBwT9lrBEGqnmaZaLdeG y842Az3T6cDJi0wgY4LCjXFCH0hhuDBGf1H07fqf5oR4UwMBQCd5DSl+RARf+VdlcP93 c0TIB8jLJoy5Zh8XGOkuf9UaZarBJ29WCX4QLVCFfuW97x+8Ijf58B/MDlZP1nB3nw/Y /FrOaYPtqQyC6hVkOi7YG6WvfkfrRvS5hy8VE/sTaFdZwRQ5NlADn6nfO5bszi2N2+O/ +WSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=vBYiMptRxwrwyAIJqR0DNTAcDHviyisXsjkfb23ttq0=; b=w2A08ZPE9jJd9hkYohpV2PI7DcbEwK9r8PKLPWWSt4xn2ALxUZgCAAx4O0ZG56Uyl4 Od85SToSyJyI7w4w9tqC7pKWNhXuPgCEgQSjH52ZBXNPc1MSxhvTGZHkjP8jJte0gJ/X PZLv92TkFm857yDlKr373dORO/XlqGZGDh1YsHri9v4EVbAgorLmUSWDINLBaqizRnnP njMdg3k0tCg9I6NerIdgLhBUz66jpU0KIxXB1WYuxALoP4TP+aVd/UtU/+WQ2YBrZ40m fTjVxWs5LUNINOLDRrpjIb87vHUuZeG092Hk3Ou/MJeK5vstrRwGRv9apoWm/0MTsC7o fCeg== X-Gm-Message-State: AO0yUKXuPc31CRdXY90JelmgyocHM29x4fUu2798p6l5tfEZntb48wKX N3G806IIVQTsLz55+5XbmBx5EdqKdDfNppnGCiFrWg== X-Google-Smtp-Source: AK7set8TpPLC0jrN5El7yp3sVD+BkJrMBsquRp5zL02w0TxSy52UxP9nOv6sfa09ah3oa1q2O9e6R3kPjyMuQ1AuvAc= X-Received: by 2002:a17:906:37c2:b0:878:7bc7:958a with SMTP id o2-20020a17090637c200b008787bc7958amr287270ejc.220.1675723194258; Mon, 06 Feb 2023 14:39:54 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Yosry Ahmed Date: Mon, 6 Feb 2023 14:39:17 -0800 Message-ID: Subject: Re: [PATCH 14/19] mm: Introduce a cgroup for pinned memory To: Tejun Heo Cc: Alistair Popple , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, jgg@nvidia.com, jhubbard@nvidia.com, tjmercier@google.com, hannes@cmpxchg.org, surenb@google.com, mkoutny@suse.com, daniel@ffwll.ch, "Daniel P . Berrange" , Alex Williamson , Zefan Li , Andrew Morton Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 6, 2023 at 2:36 PM Tejun Heo wrote: > > On Mon, Feb 06, 2023 at 02:32:10PM -0800, Yosry Ahmed wrote: > > I guess it boils down to which we want: > > (a) Limit the amount of memory processes in a cgroup can be pinned/locked. > > (b) Limit the amount of memory charged to a cgroup that can be pinned/locked. > > > > The proposal is doing (a), I suppose if this was part of memcg it > > would be (b), right? > > > > I am not saying it should be one or the other, I am just making sure > > my understanding is clear. > > I don't quite understand what the distinction would mean in practice. It's > just odd to put locked memory in a separate controller from interface POV. Assume we have 2 cgroups, A and B. A process in cgroup A creates a tmpfs file and writes to it, so the memory is now charged to cgroup A. Now imagine a process in cgroup B tries to lock this memory. - With (a) the amount of locked memory will count toward's cgroup A's limit, because cgroup A is charged for the memory. - With (b) the amount of locked memory will count toward's cgroup B's limit, because a process in cgroup B is locking the memory. I agree that it is confusing from an interface POV. > > Thanks. > > -- > tejun