From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E98382E8881 for ; Wed, 3 Dec 2025 11:22:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764760957; cv=none; b=No2MTIyRuKErE89FMxkzVq+6Ht57YhL9rWnXxH29oDSmTen77WtQUf+E7PTXWisc1917sdIte8OKCOC/ciEQwa48d0L0xEu/p6alyhqw07kn0u6/PMQNVUslIHEBTEpIjFexnjR/Qs20omZ9Ce0tpxAkrVqZBRRJooqeUs6AifY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764760957; c=relaxed/simple; bh=Ra70rAIPocOZwVn8LAoNGHSFsWLKLEMD4yOgJi1DkYQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Zw9QCFMazI+vfBrUKUv1JxY6qmdvGRDXc/eGQ2VZzHIuP6jX6Gfhas53a18MghhIH2JUsoK/HnLfbnZsymi5QPDIKW0drw+4kPkrK9udy7WffrLUenxgXYhckWZd6OPAqrQdsqU4Wx0L5pXanYYYZTcQeVsyU5vwgzyVzZFjF7k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=h1MQbpxV; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="h1MQbpxV" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2C68CC4CEFB; Wed, 3 Dec 2025 11:22:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1764760956; bh=Ra70rAIPocOZwVn8LAoNGHSFsWLKLEMD4yOgJi1DkYQ=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=h1MQbpxV1pat+Gn/jAhwJCr0oz4+Izs2LeA/8W8gcmVlXTJpjcrPgJW8VinebpcqT lioBrQXYXvOw0prQ4x5kX+aCLAM51nwfQ+1tKxlUdKrRaMHcooYDwdKmEZ1WcynRWq 2+gFdyRobfK2eXUoFCbuaHg7JeLUm2fGMG6GaM2plsKHG/8Wf8+/IudiV+1Gx+j2+5 GWFnXkLFkUjMFO4JBRyf0Dgf5KdHegXlinoZRKt4P8U8Cusk/Xw9dClzaGmIpQc5cz clIMaCHvw6tNscd+dHnWgDs6smoBMHwS+hu27OjUBKuMDGPsf0uSazrvXG8IK4fhA9 2mo9JjqvjkW2g== Message-ID: <4a9950fb-471e-4b04-8a0e-0f34e8b6a082@kernel.org> Date: Wed, 3 Dec 2025 12:22:29 +0100 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/page_alloc: make percpu_pagelist_high_fraction reads lock-free To: Michal Hocko Cc: Gregory Price , Andrew Morton , Aboorva Devarajan , vbabka@suse.cz, surenb@google.com, jackmanb@google.com, hannes@cmpxchg.org, ziy@nvidia.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Oscar Salvador References: <20251201060009.1420792-1-aboorvad@linux.ibm.com> <20251201094112.07eb1e588b6da2ee70c4641d@linux-foundation.org> <8b89bb59-6b6a-4a79-a571-e97b9ae5287f@kernel.org> From: "David Hildenbrand (Red Hat)" Content-Language: en-US In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 12/3/25 10:42, Michal Hocko wrote: > On Wed 03-12-25 10:15:04, David Hildenbrand (Red Hat) wrote: >> On 12/3/25 09:59, Gregory Price wrote: >>> On Wed, Dec 03, 2025 at 09:42:59AM +0100, Michal Hocko wrote: >>>> On Wed 03-12-25 03:35:51, Gregory Price wrote: >>>>> if (!ret) { >>>>> /* >>>>> * TODO: fatal migration failures should bail >>>>> * out >>>>> */ >>>>> do_migrate_range(pfn, end_pfn); >>>>> } >>>>> >>>>> Maybe it's time to implement the bail out? >>>> >>>> That would be great but can we tell transient from permanent migration >>>> failures? Maybe long term pins could be treated as permanent failure. >>>> >>> >>> I see deep in migration code `migrate_pages_batch()` we would return >>> "Some other failure" as fatal: >>> >>> switch(rc) { >>> case -ENOMEM: >>> ... >>> /* Note: some long-term pin handing is done here */ >>> break; >>> case -EAGAIN: >>> ... >>> break; >>> case 0: >>> ... >>> list_move_tail(&folio->lru, &unmap_folios); >>> list_add_tail(&dst->lru, &dst_folios); >>> break; >>> default: >>> /* >>> * Permanent failure (-EBUSY, etc.): >>> * unlike -EAGAIN case, the failed folio is >>> * removed from migration folio list and not >>> * retried in the next outer loop. >>> */ >>> nr_failed++; >>> stats->nr_thp_failed += is_thp; >>> stats->nr_failed_pages += nr_pages; >>> break; >>> } >>> >>> So at a minimum we could at least check for !(ENOMEM,EAGAIN) I suppose? >>> >>> It's unclear to me based on this code here how longerm pinning would >>> return. Maybe David knows. >> >> I would assume that additional references will always result in -EAGAIN. >> Remember that we cannot distinguish short-term pins from long-term pins. >> >> We should never have longterm-pins on ZONE_MOVABLE, unless something broke >> that contract and needs to be fixed. > > Right. But what should the hotplug code do under that condition. Loop > for ever or fail reporting the broken contract? I would lean towards the > latter. If you can detect it reliably. > We have never promised that offlining will not fail ever for > movable zones. We just guarantee that the operation is resistant against > recovarable failures. Right, but we don't want it to fail for reasons where retrying a bit longer would just have worked. What we document is: Memory Offlining and ZONE_MOVABLE --------------------------------- Even with ZONE_MOVABLE, there are some corner cases where offlining a memory block might fail: ... list of corner cases Further, when running into out of memory situations while migrating pages, or when still encountering permanently unmovable pages within ZONE_MOVABLE (-> BUG), memory offlining will keep retrying until it eventually succeeds. When offlining is triggered from user space, the offlining context can be terminated by sending a signal. A timeout based offlining can easily be implemented via:: % timeout $TIMEOUT offline_block | failure_handling -- Cheers David