From mboxrd@z Thu Jan 1 00:00:00 1970 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 10BA7C54E58 for ; Fri, 22 Mar 2024 01:26:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 52A646B007B; Thu, 21 Mar 2024 21:26:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4DA996B0082; Thu, 21 Mar 2024 21:26:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 37A9C6B0083; Thu, 21 Mar 2024 21:26:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 251BB6B007B for ; Thu, 21 Mar 2024 21:26:08 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id DC04E160349 for ; Fri, 22 Mar 2024 01:26:07 +0000 (UTC) X-FDA: 81922933974.11.FA8455B Received: from mail-ua1-f50.google.com (mail-ua1-f50.google.com [209.85.222.50]) by imf26.hostedemail.com (Postfix) with ESMTP id 282E4140006 for ; Fri, 22 Mar 2024 01:26:04 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=SKkyGJXD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.222.50 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1711070765; h=from:from:sender: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:dkim-signature; bh=DnrA7VCP2UghSQHIHzERUpi2aY63j1gM5buPqEdAsC0=; b=qq+xOg/1TsnPAT4R/vhats870UKsrQrp42TxYy+HXJZb1tKR5uQW1DO9RtQvT4l9pmmgKB U/ufTnh9pzxa/gQbdyqaFs06S3y4iefAVD+eEiX6Xv/MSTpWTUmJdfh12RwBCuzz0gMFzH Cb+k9R9Yx1pN/+eMII95fCN3OkzP7DI= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=SKkyGJXD; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf26.hostedemail.com: domain of 21cnbao@gmail.com designates 209.85.222.50 as permitted sender) smtp.mailfrom=21cnbao@gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711070765; a=rsa-sha256; cv=none; b=gMQvku8i4fthBDZRhBpNUoX7dQ7iko8Fo4v9U3RISzFQP5aynOKkzpKN3OlWECA13H0o0w ML4Y+mpZMqWoQb7E/J+7z5cJY80L/SO7KKpoBCL1nN6S2E6zHu5/5qPB1NTzzWVEm+J5ZT zselKBXsfG0GLkF//9sLjyQhRHUMWeM= Received: by mail-ua1-f50.google.com with SMTP id a1e0cc1a2514c-7e07aabfd87so906974241.0 for ; Thu, 21 Mar 2024 18:26:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711070764; x=1711675564; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DnrA7VCP2UghSQHIHzERUpi2aY63j1gM5buPqEdAsC0=; b=SKkyGJXDrtO2MLTU8JO7Y7YIBrefmcZMF/8G28u4FGoCH/wmSCQIEQivN+Qdq3MPeV ZkxDi/blJ3Aw246yyr30u+AJ3yZAFbpFs0zW4pcjU7+KwZ4fIbKsM6bnr5ejnzC5apqs mwJUWhNzakr00rvPYyHK+VDLTLKf4Whf0UOwDc93NFavV38+GBQY/51ss5JAsZ1jXF0G 3x0zVtccYmCZcLTwb7PHOYjnw0IGt6GdIAw/Va3RPwxgKtDjryKy4QWz+mL8YgIXno2u 6iAg9JyaD456gbRvPA174i5UOlXRyMujFcgS17CMgQWNqmZZ6LDcT4BKUoshq6aV/rHv msbQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711070764; x=1711675564; h=content-transfer-encoding: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=DnrA7VCP2UghSQHIHzERUpi2aY63j1gM5buPqEdAsC0=; b=XagotWN8hZ0RIm1hh9syypWat5yONgq4mFfpxEn4bYjaf2GlsaIKTb3QuBY4fejSQq yKx5DWZlBrKtO28VoQcPFHtLyKRXPmbdpGhjK7AJ886X4KA62x/4XzFpsg0PkYA3S4cB Btf6r4Yt/jetguAlKNZCR8kql1F6w7eU6HzwKQsxBLmqB5I9dyF/GxB7fGluUyleRxNQ /jsfv6kCX/UeDlQn/f50O+CvloX7BYWzowyMqPgiTyIDE/zOi1rQPYE9zR8ez4AbVQ9V b06RFc1YE0Eu5NLmU9PMxC5HGtXD1hqh+V3vxafj9Lg0OBB9KLyjfcjyJVqHO+D4XhOW ku6g== X-Forwarded-Encrypted: i=1; AJvYcCWGe3/KY5LFpL0sJ8YOCrNq5y3F/ABNALv+5eC92bt2PY7iHn3RNQfGOYn2Bd12HqHVJViQLFgy2WIfsD9CahHMTK0= X-Gm-Message-State: AOJu0Yw7R8auUEBqXId9n4TJJSenriq3yUfgYwagYg6b/NZ3FZCqOPWR arfisEjxGXfRJW/ow9M7FB/qdRLcng2dNJHV3B/QRGxVcM8TLj12vDAnBUnvyp6oo/dVP6PNtzW G8mTjwBE9x4sLBX3Il3dnaJFuZYc= X-Google-Smtp-Source: AGHT+IEX3LGVYC4fhTEF6otGyeJAhOWJOQ4fPtLG/kizcg2xXDVzlPfBIxephr3HBjwl6XPh7D3ehuvyP21vvXMlokI= X-Received: by 2002:a05:6102:2c6:b0:476:70e3:98ba with SMTP id h6-20020a05610202c600b0047670e398bamr383936vsh.9.1711070764109; Thu, 21 Mar 2024 18:26:04 -0700 (PDT) MIME-Version: 1.0 References: <20240314141516.31747-1-liuhailong@oppo.com> <20240315081803.2223-1-liuhailong@oppo.com> In-Reply-To: From: Barry Song <21cnbao@gmail.com> Date: Fri, 22 Mar 2024 14:25:52 +1300 Message-ID: Subject: Re: [PATCH v2] Revert "mm: skip CMA pages when they are not available" To: =?UTF-8?B?5YiY5rW36b6ZKExhb0xpdSk=?= Cc: Michal Hocko , "akpm@linux-foundation.org" , "nathan@kernel.org" , "ndesaulniers@google.com" , "trix@redhat.com" , "linux-mm@kvack.org" , "linux-kernel@vger.kernel.org" , "llvm@lists.linux.dev" , "surenb@google.com" , "zhaoyang.huang@unisoc.com" , "quic_charante@quicinc.com" , "yuzhao@google.com" Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 282E4140006 X-Stat-Signature: tgwajd8dspwwcbjs3yaiq1bsyw3gxorc X-HE-Tag: 1711070764-870441 X-HE-Meta: U2FsdGVkX18X8ZUA8sgycD+qGc7qneL0Bip4+vwXeTsRrjKdyXjbfjvoZ2LaVUmDa8Wb6+asFClhQzpT1fVTgwIuBrPP7YkPOvemmAUtCYJyggGXFPb+mwqd+MblvygqcXdcuhpQyqoFHC95X6ErcquclfuOeS151Y337VsReD+/iVfWBFGYzneoj0RcQe+0b5FtLFCrk0QBJe4B7uQv8uI8LrzeQM8WCPCxybNQKJgvX0BqfbR+94aXalOqQBn4VoQPjHyMOnhq5MrQN9XhMNqPHN9j4WRKDnUvCq4HpdNG1ha5B5VnQ7SHvn2ixAvHx34+7AqqFf/FLuEQWD01KyVTX9ejmCm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ZN2hPjnpTJFf90Z2sh3R6pMg+pqPp5KRLMMZL0DPjj8u0UK9O4wklpTMpGE7JkzrAT4z2TWa/kSQNgFR3qsQ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: On Wed, Mar 20, 2024 at 1:27=E2=80=AFAM =E5=88=98=E6=B5=B7=E9=BE=99(LaoLiu)= wrote: > > On 2024/3/19 19:09, Barry Song wrote: > > On Tue, Mar 19, 2024 at 4:56=E2=80=AFPM Michal Hocko = wrote: > >> > >> On Fri 15-03-24 16:18:03, liuhailong@oppo.com wrote: > >>> From: "Hailong.Liu" > >>> > >>> This reverts > >>> commit b7108d66318a ("Multi-gen LRU: skip CMA pages when they are not= eligible") > >>> commit 5da226dbfce3 ("mm: skip CMA pages when they are not available"= ) > >>> > >>> skip_cma may cause system not responding. if cma pages is large in lr= u_list > >>> and system is in lowmemory, many tasks would direct reclaim and waste > >>> cpu time to isolate_lru_pages and return. > >>> > >>> Test this patch on android-5.15 8G device > >>> reproducer: > >>> - cma_declare_contiguous 3G pages > >>> - set /proc/sys/vm/swappiness 0 to enable direct_reclaim reclaim file > >>> only. > >>> - run a memleak process in userspace > >> > >> Does this represent a sane configuration? CMA memory is unusable for > >> kernel allocations and memleak process is also hard to reclaim due to > >> swap suppression. Isn't such a system doomed to struggle to reclaim an= y > >> memory? > Yes, All processes in the system are also hard to reclaim. and all proces= ses > enter direct reclaim. with this patch, much of process which should skip_= cma > would retry, scan, skipped in the process of isolsate_lru_pages. and syst= em > process will have high priority, some normal processes (like kswapd) are > preempted. > > > Btw. how does the same setup behave with the regular LRU > >> implementation? My guess would be that it would struggle as well. > > > > I assume the regular LRU implementation you are talking about is the LR= U > > without skip_cma()? > > > > I remember Hailong mentioned something like " it also trigger memory ps= i > > event to allow admin do something to release memory" and " without > > patch the devices would kill camera process". So it seems the differen= ce > > is if a killing will occur. > > > > Hailong, would you like to provide more detail? > > psi_event triggered after psi_memstall_leave. much system processes > perform_reclaim scan and skipped and leave without reclaim any pages. > the process is fast, so lmkd (userspace lowmemory killer) could not work > as before. Can you provide more details? Does PSI still give accurate reports when processes are stuck in an idle lo= op because most pages in the LRU list are in CMA? Also, in such a case, will the LMKD not receive CPU resources to execute? > > > > >> -- > >> Michal Hocko > >> SUSE Labs > >> >