From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 809EF3921C0 for ; Tue, 13 Jan 2026 13:40:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768311661; cv=none; b=ohJqMbTgDqd46jp5sLWW2NU01M90410By00e7am1nQX/sRKT27gowekeJRAfihv4YZIZbmkSXj3HzehLWakfji/IXz4beKKFm0mM+vm3xfK+aFyI9W7B/407IveHKoPgyJWzG49lNYKdtnahTWjDJQMNo46RRolbXdJcIqUfaiI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768311661; c=relaxed/simple; bh=jGzGrD/PbeywSnmSsKK8romCiGJbqWqEAzsE4Ch9YtE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=taTYIH0ggMrZZPdN/bWRystsdGmC1u5CfFWzUo0/xwHr4WRpdB6I+wYMcVyRMBi6pFlWPaO4qxP+watvRb2IY8FhZ5j0Txf12AjIA0FbBZkeLMCrGqd4h1jRdPiYRFZ/87yzPs3uey5f25pLaFn2RT7dCoQ2m7866BQFYxgg1Ss= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=dQUGLxkk; arc=none smtp.client-ip=209.85.128.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="dQUGLxkk" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-477a2ab455fso69384995e9.3 for ; Tue, 13 Jan 2026 05:40:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1768311657; x=1768916457; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=hOqKXa6v4TuBaNjoDA47lyBnXhGd9ZScrVY1o+qPEe8=; b=dQUGLxkk8IduLU5P1LrHk1dvyAtPJwIhwnOQmC37tgcle7KSCi68M2al6w6mmlnsdI VhMRUXAOxgIpHLAfQFZx4bv/5f/JHifCJhCPHUnwoSuzivmJRbfORkPdU4oEvljuCnNg x++2hzESgmE7dnc3xGJdnncPIeqNMM3c5/He0mE9wXyW6nxLUCUwiPUlvHjnP54xOR8d S5t/sR5jEroHFgpnuQh0ZqPEkX63dswyNlLv+1g9iw+woPpduvu7jWc5o3pvcFmGIf3n jOqYRUqHCWC0PAddYuxuSHLYOWyZvq8e9H+F3iNgBSbX8BbacMYa6r/gEYoH8TA+fSbN EHUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768311657; x=1768916457; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hOqKXa6v4TuBaNjoDA47lyBnXhGd9ZScrVY1o+qPEe8=; b=cYHcxIS2J2g0Xb8EwHaxIqZ0rQQvi17z7ZE3ujAcVTfXNciD8FFrbd3ESqC3Ns4CD5 +bA6M0DPrpsWfGb4sAFLtG2L1OuK3t1zYd9lTsIa84IPbX3WKlMAz/NBxF3XWxCeq/cZ gLGhkcSaHs3h/H6wf9sKfcBxTxLZweLxTpDuT72WQ8NPFKVBYW1Y++lW0mNl7Zt8a0G9 gwPFugVjek/EAOpx1f+qnPOGCAJUT4xHBiKanwQXmAjY+lF9iYRqyaH3ImoGE9avW+xS FM9TGfO2L8Dndeu4zAWZAFsr7j0nry6xnJIlGFhyrc/6Z67rM9X3eMOovqxBrdwEVAir aNTg== X-Forwarded-Encrypted: i=1; AJvYcCVd2QoT3FISK3ivgXO3G+wqyzCYGmVX4fkgGm3tQu/XfYKSqoP3iqW8hrFD0VSaCako8YOjnTOzPODuuZw=@vger.kernel.org X-Gm-Message-State: AOJu0Yzx9W8aeDNyyJGdVHj5DOFgINUS212yTvovG6ox0cldh+b9wvzC WOCfZQhbC6JA0YV6m551aDjv0gzErvU4R8Vv8czaYnKpIff2Qjnvnxy2BTbb75UtzI8= X-Gm-Gg: AY/fxX6VDTJArZp/WXur4vEnZ1Ae9Of0ux3mno6FXhmqp1S6Z9kbnyumAUUpjB4quGU rEn8mRhmtIvy0N1DQGKeQBErfEhFcJxr325qXgdgMn8TfIcWJQGY5yfAQJ0t7mnGIGyLoeBGy6Y 2l03hsXhFWrhB7l53WjvB6xItB7IASVWnjXvk0Blq6vu5pIqklmfx+naFb7vvajdhrrueUNz6ZP SshRFMfc/Q35mcSHxmDHqt6KlPUBCsPGyXahKB0c4N9jmb6IDwN27rc1woJiMLEbiJjclmvRn8t wZj5VcWDLHF9850U0c3sKQamF8vQrNwnl6bQFdpFfMUkHp1OLzHqP3FsCq0nwwa7MQjtDqkygno /2wv79RPr2b5JDUUihuO6yBNQQoAf+r5bAfhX0QAHVbSTaQunfrdFL7kUcNbOKoLSf369BIULWU iXJwC//KQo2t469Z/3kLgVmsGh X-Google-Smtp-Source: AGHT+IF8cxzSR2U/aI/gpis3jn6E94G2h+DlhGUvJnL7EqPj7dinresMd7rQXy64ZZLM/dvYDYNI2g== X-Received: by 2002:a05:600c:19cc:b0:47d:264e:b35a with SMTP id 5b1f17b1804b1-47d84b19f69mr245181875e9.13.1768311657513; Tue, 13 Jan 2026 05:40:57 -0800 (PST) Received: from localhost (109-81-19-111.rct.o2.cz. [109.81.19.111]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-432bd0daa78sm45085370f8f.6.2026.01.13.05.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Jan 2026 05:40:57 -0800 (PST) Date: Tue, 13 Jan 2026 14:40:55 +0100 From: Michal Hocko To: Akinobu Mita Cc: linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, akpm@linux-foundation.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, hannes@cmpxchg.org, david@kernel.org, zhengqi.arch@bytedance.com, shakeel.butt@linux.dev, lorenzo.stoakes@oracle.com, Liam.Howlett@oracle.com, vbabka@suse.cz, rppt@kernel.org, surenb@google.com, ziy@nvidia.com, matthew.brost@intel.com, joshua.hahnjy@gmail.com, rakie.kim@sk.com, byungchul@sk.com, gourry@gourry.net, ying.huang@linux.alibaba.com, apopple@nvidia.com, bingjiao@google.com, jonathan.cameron@huawei.com, pratyush.brahma@oss.qualcomm.com Subject: Re: [PATCH v4 3/3] mm/vmscan: don't demote if there is not enough free memory in the lower memory tier Message-ID: References: <20260113081453.8293-1-akinobu.mita@gmail.com> <20260113081453.8293-4-akinobu.mita@gmail.com> 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=us-ascii Content-Disposition: inline In-Reply-To: <20260113081453.8293-4-akinobu.mita@gmail.com> On Tue 13-01-26 17:14:53, Akinobu Mita wrote: > On systems with multiple memory-tiers consisting of DRAM and CXL memory, > the OOM killer is not invoked properly. > > Here's the command to reproduce: > > $ sudo swapoff -a > $ stress-ng --oomable -v --memrate 20 --memrate-bytes 10G \ > --memrate-rd-mbs 1 --memrate-wr-mbs 1 > > The memory usage is the number of workers specified with the --memrate > option multiplied by the buffer size specified with the --memrate-bytes > option, so please adjust it so that it exceeds the total size of the > installed DRAM and CXL memory. > > If swap is disabled, you can usually expect the OOM killer to terminate > the stress-ng process when memory usage approaches the installed memory > size. > > However, if multiple memory-tiers exist (multiple > /sys/devices/virtual/memory_tiering/memory_tier directories exist) and > /sys/kernel/mm/numa/demotion_enabled is true, the OOM killer will not be > invoked and the system will become inoperable, regardless of whether MGLRU > is enabled or not. > > This issue can be reproduced using NUMA emulation even on systems with > only DRAM. You can create two-fake memory-tiers by booting a single-node > system with "numa=fake=2 numa_emulation.adistance=576,704" kernel > parameters. > > The reason for this issue is that memory allocations do not directly > trigger the oom-killer, assuming that if the target node has an underlying > memory tier, it can always be reclaimed by demotion. Why don't we fall back to no demotion mode in this case? I mean we have shrink_folio_list: if (!list_empty(&demote_folios)) { /* Folios which weren't demoted go back on @folio_list */ list_splice_init(&demote_folios, folio_list); /* * goto retry to reclaim the undemoted folios in folio_list if * desired. * * Reclaiming directly from top tier nodes is not often desired * due to it breaking the LRU ordering: in general memory * should be reclaimed from lower tier nodes and demoted from * top tier nodes. * * However, disabling reclaim from top tier nodes entirely * would cause ooms in edge scenarios where lower tier memory * is unreclaimable for whatever reason, eg memory being * mlocked or too hot to reclaim. We can disable reclaim * from top tier nodes in proactive reclaim though as that is * not real memory pressure. */ if (!sc->proactive) { do_demote_pass = false; goto retry; } } to handle this situation no? -- Michal Hocko SUSE Labs