Received: by 2002:a05:7412:cfc7:b0:fc:a2b0:25d7 with SMTP id by7csp1034170rdb; Mon, 19 Feb 2024 01:55:32 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWwWZ2xDsalBODk1x8ZcCdsnFpLaVWoNoemohJ/z4ucYNBp6vxLw2tZ+bxQ5PVPZ/L1VYeIno7H7jO8BxHHnUgTYN3MTJjX0CWqzRSqbg== X-Google-Smtp-Source: AGHT+IHbbS8CUpUIZNvai7m46SUqPpGbqf0+pVA5KaakO4wHnR3DmKynMajFnD5ZyrOqhuXYJPlq X-Received: by 2002:a05:6402:22c4:b0:564:957f:a5f9 with SMTP id dm4-20020a05640222c400b00564957fa5f9mr543767edb.29.1708336532032; Mon, 19 Feb 2024 01:55:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708336532; cv=pass; d=google.com; s=arc-20160816; b=visbJCygULujxc5YN6JilhFjrG0uE50hTjlh0C2MPJaUIUUw0RZaizfi91mQ+Fqm6z QI4XuKqUD1TTjQPa7yIT4j6UR8if+VxjAQeEoq9Qeu1kuRh+kX1LVuFAz2TTTTMx43Ab H1+dinnxExyZVshPifS7S4D8kNNh2F22P7Th/VN/uU3vXmr3VzbxNOgE9KE0iMXUyFUj 8sH8TC7PkJ/UD9IMl7QDAqLgXr+35o48yBCR6m23CxpYs44Mg+E4LjgowqU4C6bd6+v7 CWtXMhUyD2k59qmwDiFGv2fZiztJKEOHjk1PBr7rUaQgS/U6rc5yUD4gcCy1dWhBEMp5 ESew== ARC-Message-Signature: i=2; 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=HjH7v7MwvWWsSPBnkhGSwPRvi6ZG5EixZmbA5olhbF8=; fh=HLRLNB8JFa2xLjSknaVsZEbRmDFseqkjB+x9HZ0H0XY=; b=aY+mtF9wStCZxuXqQ9cN+XbgVgtLsTqJb9H4nmdE9xl8GRNnmA/OCCFI2qgLXT+8IP Nil/hKuFh3c0MvvlC4FICAPxl/cjuKYGSY1fDxr3JhpvISJHw8pUOoGIvOxYgFrIknrt JAmD1WZmeMpcwHpidUoYDfWKCJFaMZPEZNAUBI4t8SbDkmNrCoKJAOBmmO5OjxVVh0lw vDEvCeIOkAiLUCWYadmEIzUo7PFcBS+XNFzZ3XDDrXmU85B+C13zbbzageo8wWj2nkUX ++PuornsQ9ifJX85C/TxobU0Dig69pz3Y5TAy+Y9NcVzTGR5VN1wCmpCxxzuCO27rhEe cwzg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=cJVJhjkM; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-71073-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c22-20020aa7c756000000b0056410580bdasi2347535eds.155.2024.02.19.01.55.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 01:55:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71073-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=cJVJhjkM; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-71073-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.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 C46B81F22C27 for ; Mon, 19 Feb 2024 09:55:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EB90125620; Mon, 19 Feb 2024 09:54:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="cJVJhjkM" Received: from out30-131.freemail.mail.aliyun.com (out30-131.freemail.mail.aliyun.com [115.124.30.131]) (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 38DB525614; Mon, 19 Feb 2024 09:54:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708336484; cv=none; b=WKOekneIpiJUa8zEFif7A6VZj2IHyejE62RyivaLbSYStWD28Bfo74y9+s5oFjqCm9cFZ/ShZHz0StNLbWzxnF1xhdkfyJ5pnv6RPKxc/PX/Qz5N0aoxBOTxnRmTmbCTckG8CjBAT5snwjd8Gyb0lgqqSa37ofFQC6PqCLZ9ps4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708336484; c=relaxed/simple; bh=2PGHb0YK6zNzLpgmDozQJqP4grk2DdHx3T5vOsHWuqg=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dN5DFuCH+2SPV2Wm9VFXzTDfT6AVzoCLyAL9LrOWC6iB/XELCSzSUMY/LPqpuDhHJj2TFvjK0ZV2LSFrONzFGLNsU0LvMr38lRAVW98Rknj+QLFc+iGdNH0Pv28I1/Z5mMOajwZshsKZzopNUnQGULbGa78yuurAdvvL/JZtyIE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=cJVJhjkM; arc=none smtp.client-ip=115.124.30.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1708336479; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=HjH7v7MwvWWsSPBnkhGSwPRvi6ZG5EixZmbA5olhbF8=; b=cJVJhjkMFc3/SgYQ5niz4Vqd0l0S7c6Bt+wDTOKDZ80IP5Yn0WA0Cg5q6YgfscolA3eCof5yPsHqECoqSxmUDOoNm5Edc9Vaax3M32e8ZCcN8e63ARlxPnsJfieIIgSDH6x04NNsK/PtPaRZ5i9mjafUA6esGWagQW5jaqg/45c= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R201e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0W0sB01V_1708336477; Received: from 30.97.56.48(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0W0sB01V_1708336477) by smtp.aliyun-inc.com; Mon, 19 Feb 2024 17:54:38 +0800 Message-ID: Date: Mon, 19 Feb 2024 17:54:36 +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] mm/vmscan: Fix a bug calling wakeup_kswapd() with a wrong zone index To: Oscar Salvador Cc: Byungchul Park , akpm@linux-foundation.org, ying.huang@intel.com, hannes@cmpxchg.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, kernel_team@skhynix.com, stable@vger.kernel.org References: <20240216111502.79759-1-byungchul@sk.com> <517e58d4-7537-4d9f-8893-0130c65c3fdb@linux.alibaba.com> From: Baolin Wang In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2024/2/19 16:11, Oscar Salvador wrote: > On Mon, Feb 19, 2024 at 02:25:11PM +0800, Baolin Wang wrote: >> This means that there is no memory on the target node? if so, we can add a >> check at the beginning to avoid calling unnecessary >> migrate_misplaced_folio(). >> >> diff --git a/mm/memory.c b/mm/memory.c >> index e95503d7544e..a64a1aac463f 100644 >> --- a/mm/memory.c >> +++ b/mm/memory.c >> @@ -5182,7 +5182,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf) >> else >> last_cpupid = folio_last_cpupid(folio); >> target_nid = numa_migrate_prep(folio, vma, vmf->address, nid, >> &flags); >> - if (target_nid == NUMA_NO_NODE) { >> + if (target_nid == NUMA_NO_NODE || !node_state(target_nid, N_MEMORY)) >> { >> folio_put(folio); >> goto out_map; >> } >> >> (similar changes for do_huge_pmd_numa_page()) > > With the check in place from [1], numa_migrate_prep() will also return > NUMA_NO_NODE, so no need for this one here. > > And I did not check, but I assume that do_huge_pmd_numa_page() also ends > up calling numa_migrate_prep(). > > [1] https://lore.kernel.org/lkml/20240219041920.1183-1-byungchul@sk.com/ Right. I missed this patch before. So with checking in should_numa_migrate_memory(), I guess current changes in numamigrate_isolate_folio() can also be dropped, it will never hit a memoryless node after the patch [1], no?