Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp2079345rdd; Thu, 11 Jan 2024 20:40:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IHWJu5iViRLbCGz5mUGHWmhRQLJjyA7wE3oExfpsrMWA9F1R0RMwFbAi7+93l0tKjfKCFWQ X-Received: by 2002:aa7:de0f:0:b0:558:b975:1ff3 with SMTP id h15-20020aa7de0f000000b00558b9751ff3mr948082edv.6.1705034449973; Thu, 11 Jan 2024 20:40:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1705034449; cv=none; d=google.com; s=arc-20160816; b=BwLhQc/NGiRB2DtohBeUh7x8xCYsnZ/jhrAj5Oze5ehCkA22yXTkaJOP0RjO3Bn2xG 498Q/tHa6TsvsPsWZecB9lkrK6otggzyZ+xo1CcZpWidb3JcFYyTVKmDlefyqsgydf75 epMFcIceLkC3xgbn12hINDcSlia3R6HwDJ4M6dVRCWNlHpQYZ6HVkHFT/sZpOLu8pME2 uW5lpdapSsN4A/5Wtq61e7CTY+Pb+Ia2KNqOJseP2W4c08W3G/Hab5by6ySuari6dq/p NueIWHnHfBivGLC4PPGE1B1s0ijnEz9AE6Al82RjVzzfLbIW2sa/LeNKKGN5G0zEtavi FnCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=xfOxzzXYXmHCZ083e+lA7aFwvPpCcgTSJ2++Tqb/A8g=; fh=lkZ7Y9Hy6xhRI9RxFvP2gqYDQKez3Ow32OpBU0iLJ4Y=; b=sxE5IcGGRtpcwjq5aoxwew6fUVfykULAnS3ZRNYqg1t2n3MLEVxC4JDgHJ1yFa7aca HOIFhD3cScqVhSmMfajpw76Y2D5453R9klHwXYlCdj4okRFeHadU1jxWLpeMokeUk2Hg oGnEYU4DfVBcK9U3QLcpTxy/B+Jf3JgImG2+CpzUMDLa0yTOF/BkCPoVsAZPgVv5iJiN O3hEFRYm0+VMqJ2xNvfyzWTa1qIc24a9uCzLNV9zwKcFduR4DhNaQhvCpqPrGLyzbIvQ eevoyZsQjqPD7q5fc4B9L4cGhcJSamZSOo/THRqFjBL7ArZBXkDljARaztWZjnwEy0a4 9YDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-24292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24292-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c2-20020aa7c982000000b00553dd72eb43si1110587edt.477.2024.01.11.20.40.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Jan 2024 20:40:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-24292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel+bounces-24292-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-24292-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=antgroup.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 am.mirrors.kernel.org (Postfix) with ESMTPS id B38E61F25EE2 for ; Fri, 12 Jan 2024 04:40:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 092485B5B4; Fri, 12 Jan 2024 04:40:42 +0000 (UTC) Received: from out0-194.mail.aliyun.com (out0-194.mail.aliyun.com [140.205.0.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D3507F4F7 for ; Fri, 12 Jan 2024 04:40:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=antgroup.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=antgroup.com X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R661e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018047194;MF=henry.hj@antgroup.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---.W4EnNzt_1705034428; Received: from localhost(mailfrom:henry.hj@antgroup.com fp:SMTPD_---.W4EnNzt_1705034428) by smtp.aliyun-inc.com; Fri, 12 Jan 2024 12:40:29 +0800 From: "Henry Huang" To: yuanchu@google.com Cc: , "Henry Huang" , "=?UTF-8?B?6LCI6Ym06ZSL?=" , , , , "=?UTF-8?B?5pyx6L6JKOiMtuawtCk=?=" , Subject: Re: [RFC v2] mm: Multi-Gen LRU: fix use mm/page_idle/bitmap Date: Fri, 12 Jan 2024 12:40:22 +0800 Message-ID: <20240112044026.58580-1-henry.hj@antgroup.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Thanks for replying. On Thu, Jan 11, 2024 at 03:24 AM Yuanchu Xie wrote: > Does this present a problem with setting memcg limits or OOMs? It > seems like deterministically charging shared pages would be highly > desirable. Mina Almasry previously proposed a memcg= mount option to > implement deterministic charging[1], but it wasn't a generic sharing > mechanism. Nonetheless, the problem remains, and it would be > interesting to learn if this presents any issues for you. > > [1] https://lore.kernel.org/linux-mm/20211120045011.3074840-1-almasrymina@google.com/ In this case, total size of shared memory usually is small(< 100MB). What's more, almost shared pages were file cache. So it doesn't present any problems. > I'm working on a kernel driver/per-memcg interface to perform aging > with MGLRU, including configuration for the MGLRU page scanning > optimizations. I suspect scanning the PTE accessed bits for pages > charged to a foreign memcg ad-hoc has some performance implications, > and the more general solution is to charge in a predetermined way, > which makes the scanning on behalf of the foreign memcg a bit cleaner. > This is possible nonetheless, but a bit hacky. Let me know you have > any ideas. Wow! per-memcg interface is also what we need. It's hardly to control user's behaviors in our envrionment. We can't promise that all process who share memory would be in same memcg. Maybe kernel should provide new interface to make shared page charge more predictable. I think it would take some overhead to do this. The key problem of us is that we can't check whether page is accesed(no gen or ref changed) in this case. page belongs to A, but maybe process in B read/write this page more frequently. we may treat this page as cold page but accutly hot page. Maybe just call folio_mark_accessed instead of folio_update_gen(should hold memcg lru lock) for those remote memcg pages? -- 2.43.0