Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1464112rdb; Sun, 7 Jan 2024 22:50:02 -0800 (PST) X-Google-Smtp-Source: AGHT+IHb/wcL7/RqlSgeBDZ3wvTQZ1vJh1qnqdgSRIOwQOLRA3vgKinsWIBVb64apjhNhET7ZKsb X-Received: by 2002:a17:903:22ca:b0:1d4:341c:db32 with SMTP id y10-20020a17090322ca00b001d4341cdb32mr4249211plg.11.1704696602504; Sun, 07 Jan 2024 22:50:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704696602; cv=none; d=google.com; s=arc-20160816; b=BgkPJWdqEkZjagTe7AO2hQqV9aJ9datnhig/ocHeJCsHe0Hwi+nmKjiWMZ6B8I1qG+ qk47ipLl2PcsPw3Rf1gH/TTnA18whOibgqQN7/zM8g+pA8c5EJW24o7pUn57EXqZwLP3 Ea+dmaB++GmgCWHuNNMRxO7D9YgggcNfd6YdKPan4g/iqc2Fwb+tG8LLpoIoN9cVTaKi QirmU0jup4gf9ATglcU0UaH30kAZsTr2TIBfCAEY/O5s5/kZ+nDX4VKpmCSF7+S7dZkp wQVv3E8G0xGdGpYL34z4zxLIFEIEKkZOwrd6Vk10HjDjTiAkMjLGOn6s4mD39nq+TrI+ WSZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id:dkim-signature; bh=Tt7PGUQ5L43nYUE94yk4XF4aImWy48h5RdG3yYl8t6c=; fh=AAhjyuHVW4x2W+TrPQ7l+sTiE59TVMfnxZWbFy49oKE=; b=qVSo5fVIgs2ghDZM9IdyMNMSvJ7Ly1kzndTyjVrFP6ymbRaDx3FaBtk3enwMM6M09+ h/B36rN8QsvKedeo4/QJ19FeRLge+rWuf2LjVhKcQML3nvbulKcKkivNPVmuqavZFSCN SRC4IuW4IXctEObd5/2iMILjXuK/3qhNgJeKlHh2ploNhkQvPX+1ED6tgpd5mi/GqqPP 2WJ9uklLgPjDsOPk0gTM+gphrdW9VQKFjeAlVjFDiTvpg58sKnrBA24raQGyZR2HQAaP tW/k3lDXL/1igp2Tk4wdIrzBOKiIZzf5d122zyFYCB6K/yfasJ0QW8YsRfzuOFygjY0I PI6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shopee.com header.s=shopee.com header.b=OwqMnmlY; spf=pass (google.com: domain of linux-kernel+bounces-19118-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19118-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=shopee.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id u1-20020a17090341c100b001d4e311a29esi5699011ple.542.2024.01.07.22.50.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 07 Jan 2024 22:50:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19118-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@shopee.com header.s=shopee.com header.b=OwqMnmlY; spf=pass (google.com: domain of linux-kernel+bounces-19118-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19118-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=shopee.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 2A4C2280EB4 for ; Mon, 8 Jan 2024 06:49:58 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 02ABEB66C; Mon, 8 Jan 2024 06:49:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=shopee.com header.i=@shopee.com header.b="OwqMnmlY" X-Original-To: linux-kernel@vger.kernel.org Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AA8ACB665 for ; Mon, 8 Jan 2024 06:49:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=shopee.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=shopee.com Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-6d9344f30caso953881b3a.1 for ; Sun, 07 Jan 2024 22:49:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shopee.com; s=shopee.com; t=1704696577; x=1705301377; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=Tt7PGUQ5L43nYUE94yk4XF4aImWy48h5RdG3yYl8t6c=; b=OwqMnmlYLvURIl9QtFMLrHVdWZfv9XnlkyehWqik1btaZ+kdwaaIHtR0PT523qsQxt /tsFJ5LaGEWThxXBUqz9fGt9N06/eCuTCUnsUpJifaOszEuUbBsMMQJ+eRWn5Ioct5b3 puTdZclYm5hPmtz2joAt9P34Udb3VvfMIKJKOcMHRIefz/6oXTYdeAjNLzq3bpdn77xV i5ITT+KY3SY0MEgBDzasfeZVjvGO2c39TWauaT92nhYs6yPbxSwalHRtEE74jR16IMyl y7mAW+ElfOTI7oXCDr7LIeI1FKTQCXnZBAkmE5fUPA7bUCxDTE6+Sq2rW/W21Xu6b0t8 kjzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704696577; x=1705301377; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=Tt7PGUQ5L43nYUE94yk4XF4aImWy48h5RdG3yYl8t6c=; b=DCqDhMqo9N2GrPrshAvP1Onvsvs+ohLIgLiBJ/ONzsEJ7pPJnJrCuocu7fj1ff2BhO FnNHmS4JeRZUblTNzCS7Nlq52qpHL6brKKuatmjwXDM95Slty6t7/yjE8SToNi1s0khY hg4x31tvNzTHcVRVIhSGMbhj834xEOxpo1IbtK6og364NEinCbkPKMAHO++wdEj4BtYe Jz5UNrs/7EfkzMkoV+0MBXgZ+lvILVHt93qoLeztX4hbcuO88CSzbK+btOYIDOzsUHJg J7/QB8GnuO30LpzPKIj57QQYrxl0ZnxbEA/JCsFFx6/elzA7T8VdWYGRAySz8jE4Q+aU MJig== X-Gm-Message-State: AOJu0Yx8zscFAPAwmnk+rtpTX9Vtcob2okJossFINlugJgjyf9YepgcB 9vZymHMGQOS7MLrS208LYjXSIjMIFtOZ/0Ow4TLN2NiGoCASol2N X-Received: by 2002:a05:6a00:731:b0:6da:ca4b:8632 with SMTP id 17-20020a056a00073100b006daca4b8632mr5746697pfm.5.1704696576864; Sun, 07 Jan 2024 22:49:36 -0800 (PST) Received: from [10.54.24.52] (static-ip-148-99-134-202.rev.dyxnet.com. [202.134.99.148]) by smtp.gmail.com with ESMTPSA id p28-20020a056a000a1c00b006d9b30b33b0sm5235704pfh.196.2024.01.07.22.49.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 07 Jan 2024 22:49:36 -0800 (PST) Message-ID: <70448afd-cb53-478c-83fc-831c712e9a82@shopee.com> Date: Mon, 8 Jan 2024 14:49:31 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/2] mm: list_lru: disable memcg_aware when cgroup.memory is set to "nokmem" To: Roman Gushchin Cc: akpm@linux-foundation.org, hannes@cmpxchg.org, mhocko@kernel.org, shakeelb@google.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org References: <20231228062715.338672-1-haifeng.xu@shopee.com> From: Haifeng Xu In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 2024/1/3 09:53, Roman Gushchin wrote: > On Thu, Dec 28, 2023 at 06:27:14AM +0000, Haifeng Xu wrote: >> Actually, when using a boot time kernel option "cgroup.memory=nokmem", >> all lru items are inserted to list_lru_node. But for those users who >> invoke list_lru_init_memcg() to initialize list_lru, list_lru_memcg_aware() >> returns true. And this brings unneeded operations related to memcg. >> >> To make things more convenient, let's disable memcg_aware when >> cgroup.memory is set to "nokmem". > > I guess it's not only more convenient, but also should save a bit of memory. > But _probably_ not enough to justify messing up with stable backports. > Do you have any data on memory savings? Do you mean that it will remove the allocation of 'list_lru_memcg' in memcg_init_list_lru_one()? In fact, even without this patch, if we set cgroup.memory set to "nokmem", all memcg's kmemcg_id is -1, so memcg_list_lru_allocated() always returns true and we won't invoke memcg_init_list_lru_one(). > >> >> Signed-off-by: Haifeng Xu > > Acked-by: Roman Gushchin > > Thanks!