Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp8244251rwb; Tue, 6 Dec 2022 16:16:34 -0800 (PST) X-Google-Smtp-Source: AA0mqf4KbgqDtuOsmhw4pzlEFY2JuDQCrBQ6kMeLCa1Z5yfurWgRhz/CVuwrqIFq5FqmjFVYYlhr X-Received: by 2002:a17:902:7c0e:b0:189:907c:8390 with SMTP id x14-20020a1709027c0e00b00189907c8390mr44615449pll.126.1670372194140; Tue, 06 Dec 2022 16:16:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1670372194; cv=none; d=google.com; s=arc-20160816; b=JLcmUeBHtRFs8mLkmpnuvuYZLLSGP96rM82j7Q+//ztXK6cPTbDpibfgK6wCei8jed UIt4BaxYEpECdiTaYqyuEXUoY6Z0PPV0LdMW2Hz2uLUB8wYp/qHp0NOHkPALQm7C1+II g0gXw9+dyNa7124if7SkMFInF2NGKgYFWWa137XQR3OGz144XwQvXTwZr+Bn+oyvpiEw AC5N3rNvQp/wrWkOgqmabp/AlCGdWqwuqqW+gco1M9UFP/g+niMmq3wjeV4tUTdqHDRs 8T5phdacJUOX1vOdC3COmtyfYET8T4GY6MCWiaIf/lhogSJUPkHOA0TIxw6kls4pSAUy Al6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=XnTgKg0UKBuUXCDS87fs4ThlofePgHVyLSIXWjERYso=; b=QEEZ/YbW0cvXAtu+K9ko0teU+7VMVsu2fEBg5NjDvCrIeQAJEOkGXMho4czciNpG9o v2/8LU0uFIE3Z22QVh5SFxsvCi9ZnNHP/10ToCTms/zqbsTGZ2D0LnLZLBtMu/VHeY90 RyQk1chixGJbTacbWNzd4dLNbPA97VVTR2Bxwgc1DBK3ZXf/h7gQIpGwW6Dc8L7vQfoH Vgcb9boCW6zYM8HqpaPYfZtW1YobPOF+VOfCKSmYHsrVD+sZlGOQC2Na7l7d2p3/IASk eeHy1wc6/6SHc7R2Ax+L/7ksBTRXUp6RnNStXZIVs0+VHBX2+foyHVZmjJZUp8fpA53S op0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XrKy6coL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i125-20020a625483000000b00572f79a30f7si17187765pfb.280.2022.12.06.16.16.23; Tue, 06 Dec 2022 16:16:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=XrKy6coL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229527AbiLGAEX (ORCPT + 77 others); Tue, 6 Dec 2022 19:04:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229651AbiLGAEI (ORCPT ); Tue, 6 Dec 2022 19:04:08 -0500 Received: from mail-yw1-x112f.google.com (mail-yw1-x112f.google.com [IPv6:2607:f8b0:4864:20::112f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD23864C2 for ; Tue, 6 Dec 2022 16:04:06 -0800 (PST) Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-3b48b139b46so169444207b3.12 for ; Tue, 06 Dec 2022 16:04:06 -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=XnTgKg0UKBuUXCDS87fs4ThlofePgHVyLSIXWjERYso=; b=XrKy6coLfblQF02e3gM/AreF7bPpcfKkj30gZ0BhpESnFNZhQXBj/1CzMypZxtTnGR pbY/A/7RzNHkPzaMcpiNPbFf6ZpHCRK7eY5eQR1kJ1lswapS6MX5WK2mHkk9ltic1sHY tXyB+96tOJdcoZ1EpjuOQDi+VSUYqt98XsfwE1NbwUL8SHEuuoUwaPrzGHwQ3peCx1sL wDWpsKc4QIwYNyI6YRdi3/hZg4OMKbyKHNf6k7ZmGLW9pQZEkCt8yutE+CjIewQOQKAP aYba8W+HEW9996FyuVrK0OAFQVKqn32hG6hYDHTErCiQxFPrvisnRJXBAJ7DhsWLBhlz c61w== 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=XnTgKg0UKBuUXCDS87fs4ThlofePgHVyLSIXWjERYso=; b=wC2GuWvj5en4/MaAgu36fBuiwsUOcTWEDpldTAUB+/oUbRCg+qaxQG6g3G47BMium7 eLwMlSWfcIXFI4+WWV4xIcU1QteteEGoQxMe8FhJghPJJGt+21tu00DM0aY8a6Ndvgt5 2336QXuMDrNx5VqpOHW6v99UAbyWcQ6yWMIiviu00NWi2dogtSSV/exSGo/muVgEyPmt gLrwTyIuM/Wc4seCKT2GLIwHG7YVGe7+crxOzJ5LLF6LR1Mfe+oVmlGZisy7j4tRawLZ F5FOeKKDVQDHBD9Y2MznXvyOAGV7F4opuJFTdROCFip8BEuMoUkKQieJ3o1AUbFHkZhp yJKg== X-Gm-Message-State: ANoB5pkiPn1zu2HWI4Gi+XDEL5vm08KW5Oy6MB17PoZfWDn+iGPqaUhr LYS70yFqX3kazquQNCnJtsfwFs+YmcoTfGZTEfPY4A== X-Received: by 2002:a0d:d80c:0:b0:3ca:b34:9ce1 with SMTP id a12-20020a0dd80c000000b003ca0b349ce1mr39254464ywe.466.1670371445945; Tue, 06 Dec 2022 16:04:05 -0800 (PST) MIME-Version: 1.0 References: <20221206171340.139790-1-hannes@cmpxchg.org> <20221206171340.139790-4-hannes@cmpxchg.org> In-Reply-To: <20221206171340.139790-4-hannes@cmpxchg.org> From: Shakeel Butt Date: Tue, 6 Dec 2022 16:03:54 -0800 Message-ID: Subject: Re: [PATCH 3/3] mm: memcontrol: deprecate charge moving To: Johannes Weiner Cc: Andrew Morton , Linus Torvalds , Hugh Dickins , Michal Hocko , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 6, 2022 at 9:14 AM Johannes Weiner wrote: > > Charge moving mode in cgroup1 allows memory to follow tasks as they > migrate between cgroups. This is, and always has been, a questionable > thing to do - for several reasons. > > First, it's expensive. Pages need to be identified, locked and > isolated from various MM operations, and reassigned, one by one. > > Second, it's unreliable. Once pages are charged to a cgroup, there > isn't always a clear owner task anymore. Cache isn't moved at all, for > example. Mapped memory is moved - but if trylocking or isolating a > page fails, it's arbitrarily left behind. Frequent moving between > domains may leave a task's memory scattered all over the place. > > Third, it isn't really needed. Launcher tasks can kick off workload > tasks directly in their target cgroup. Using dedicated per-workload > groups allows fine-grained policy adjustments - no need to move tasks > and their physical pages between control domains. The feature was > never forward-ported to cgroup2, and it hasn't been missed. > > Despite it being a niche usecase, the maintenance overhead of > supporting it is enormous. Because pages are moved while they are live > and subject to various MM operations, the synchronization rules are > complicated. There are lock_page_memcg() in MM and FS code, which > non-cgroup people don't understand. In some cases we've been able to > shift code and cgroup API calls around such that we can rely on native > locking as much as possible. But that's fragile, and sometimes we need > to hold MM locks for longer than we otherwise would (pte lock e.g.). > > Mark the feature deprecated. Hopefully we can remove it soon. > > Signed-off-by: Johannes Weiner Acked-by: Shakeel Butt I would request this patch to be backported to stable kernels as well for early warnings to users which update to newer kernels very late.