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 B0D89C05027 for ; Tue, 7 Feb 2023 01:01:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230019AbjBGBBr (ORCPT ); Mon, 6 Feb 2023 20:01:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48526 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229566AbjBGBBo (ORCPT ); Mon, 6 Feb 2023 20:01:44 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9784A2ED6B for ; Mon, 6 Feb 2023 17:00:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675731657; h=from:from: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; bh=DXqw41zJAY6Fl3i7sZ9FDkyQtJd0VRXI/SNzWbqT0Bw=; b=ahMaNSc2lRLKOtxmU+08FoZfdEjNZp/EbaMuzZfi4JDsVz1tpfT+mejAZPfCIg/WGyOsrP qObTmqPQM7l9GU3uyBNlpWgRed7mikUIqi5jQDatXrQHKyTjK88cTQgAgVpHhaEtb8HWcr 4mJXeAVPCMrqqQ5IDAzW2GmOeJQ53Zw= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-659-MisY_-TcPtyqLVDHujBbpQ-1; Mon, 06 Feb 2023 20:00:56 -0500 X-MC-Unique: MisY_-TcPtyqLVDHujBbpQ-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 949893C0F22C; Tue, 7 Feb 2023 01:00:55 +0000 (UTC) Received: from [10.22.18.235] (unknown [10.22.18.235]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5E687492B21; Tue, 7 Feb 2023 01:00:54 +0000 (UTC) Message-ID: <24668a43-fb00-5240-6072-230c5f5d0943@redhat.com> Date: Mon, 6 Feb 2023 20:00:54 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH 14/19] mm: Introduce a cgroup for pinned memory Content-Language: en-US To: Yosry Ahmed , 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 References: From: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.10 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/6/23 17:39, Yosry Ahmed wrote: > 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. If it should not be part of the memcg, does it make sense to make it a resource in the existing misc controller? I believe we don't want a proliferation of new cgroup controllers. Cheers, Longman