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 C6E40C05027 for ; Mon, 6 Feb 2023 22:32:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229776AbjBFWc5 (ORCPT ); Mon, 6 Feb 2023 17:32:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229615AbjBFWcy (ORCPT ); Mon, 6 Feb 2023 17:32:54 -0500 Received: from mail-ed1-x52b.google.com (mail-ed1-x52b.google.com [IPv6:2a00:1450:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EC647EE8 for ; Mon, 6 Feb 2023 14:32:49 -0800 (PST) Received: by mail-ed1-x52b.google.com with SMTP id l12so4285798edb.0 for ; Mon, 06 Feb 2023 14:32:49 -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=l7GqiDnnbtUw28nuIsiTOre+ZKz+TpI1lg7hwVstG3g=; b=bjqC5GS/eZCj8Q0tz1L7nhIPi+KBAKimBOQARz+19LvOTMg3hMzlZzkrgdDEO6xqTb B7RSKAxUSBQ5hXb3vPRlno1jQ2dpZDRN9VUVLwy02Qh424sdV3GZybk3TDAEj4DZiAFE r065BaTFJy8y+uMmf9W4ObmnllL8uoPjTyH7+iMmk8bf2TKfR6eMn2wGIaxPpVi5NtVU gZCa1vJ87AX5mxbHOJNqbU44FQI7mCgPPROEJrSQq4YL4mTjbMThGyFHIA6R3bcYqfnA 1qUiLR04aRJKbuOqI21o9cr8g3s4afL6lwp8mHwwoD5Ap2cMEjB3r52ZQmSA0Q5hczb4 e77w== 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=l7GqiDnnbtUw28nuIsiTOre+ZKz+TpI1lg7hwVstG3g=; b=xK62aA4QBfHA3e6VthjYJVhmNrnibdyDEC+FYrtciV1abB0+7s8lkl19xf3OcIMRSD g62hJZ6UxIqdTauTdK1/6gVVdWZULQYdGjAQxBYODbGVywR0MUWVj82XIsK5cQm0hLii 6Zx1NFhNTmI1fGNDZXa2YchXCXV48HUxGReAQgnXts0fE53xC/BhC3V4GXZa8NYaypwT eFKyLnC/IYadMM4ZyQ20xs8yNsdjhB7HACRWkt+1XdJlAMjn3yNzFa5epYpqaOWZeU+D ihRRfipeQRzLpFbI9gL0Vd5OfpCGShw9uqt+qFnhm89viWIU/1iUMFAD3dt4vda6jTU3 AW0Q== X-Gm-Message-State: AO0yUKVOUUrewZYU2CDZf37g0+Hhe+ed8CiiDpSGsP6s/M/DJTs9ilIB u+0wcmg/a7hi4PXJBvNu/h5d4dgRIySG9T3OHhRqJA== X-Google-Smtp-Source: AK7set+fpQlkQiXWMD+8ZcR3RJN1nHtZejJ0HA+mjicGMdIFu+JAoEP4S27FYorBirbtxbR7/J9pRmKttPt7Z+Se9PE= X-Received: by 2002:a50:c053:0:b0:4aa:b1a9:c77c with SMTP id u19-20020a50c053000000b004aab1a9c77cmr28409edd.5.1675722767487; Mon, 06 Feb 2023 14:32:47 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Yosry Ahmed Date: Mon, 6 Feb 2023 14:32:10 -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 1:14 PM Tejun Heo wrote: > > On Mon, Feb 06, 2023 at 06:47:51PM +1100, Alistair Popple wrote: > > If too much memory in a system is pinned or locked it can lead to > > problems such as performance degradation or in the worst case > > out-of-memory errors as such memory cannot be moved or paged out. > > > > In order to prevent users without CAP_IPC_LOCK from causing these > > issues the amount of memory that can be pinned is typically limited by > > RLIMIT_MEMLOCK. However this is inflexible as limits can't be shared > > between tasks and the enforcement of these limits is inconsistent > > between in-kernel users of pinned memory such as mlock() and device > > drivers which may also pin pages with pin_user_pages(). > > > > To allow for a single limit to be set introduce a cgroup controller > > which can be used to limit the number of pages being pinned by all > > tasks in the cgroup. > > As I wrote before, I think this might fit better as a part of memcg than as > its own controller. 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. > > Thanks. > > -- > tejun