Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp225239lqp; Mon, 10 Jun 2024 01:56:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUp86vrI3+ymr25ek8WFAOQMr4BbvDWUkkSwKxuHNm9Raj7Ym+zSb9YcE3tgBha3Gy1z2wLnrwKrkU6Kwh3AaXNftGas8KGaumsJe961Q== X-Google-Smtp-Source: AGHT+IFnuGGGCgvHhk2EGu25R8kkuMgzdDPZUSvUCnNOgVc6Ia/WoqUmWRrK9CvR/xQmwJ9+iQr9 X-Received: by 2002:ac2:5933:0:b0:52c:81c0:7841 with SMTP id 2adb3069b0e04-52c81c07acbmr3396961e87.67.1718009780195; Mon, 10 Jun 2024 01:56:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718009780; cv=pass; d=google.com; s=arc-20160816; b=I6NDCElAPOiRyQXiUO835vRAvlDcqYji4zMowkzqxOf2iw9/S+peGsOFSWnWlXLurH /OoKmsm7AU50+04kN4z+Dr7IJa3TRXHPRzwTm1Q7im6NSqYiW4TiP+wPRzTRvHilXuXc oiK+sLAS1P7Kvg0MCQUAjXliSKpH6MAUzWYceN77RlrDK9TYmnW7bMx/XRz7vTny4p8q tZwJS8cWlw8RLeJsvWviaqd/B0bfGnRe+jDMG5q+AXtEjE9sDrDeyT/d0Rzvuf62xBjy 6ZtONtfgESXPtSU62avpBeVpiUylwo1W+J+FoAWFBr6WXx+sGvU6W5Vh2SjEezh9Ssyn nBDw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :date:message-id:dkim-signature; bh=K7xP27zKqY4v47zLxGRsdu26ar7Ig8tqaIa+76/1NNg=; fh=MbZx2inxWvuFXLVBOldSESOSz4J/K/xCACroX3F+MCw=; b=0hlWvgXotGiIaHP1/I2XC829ONbPyrXoLdAUyO2ER3b8gwieE/HIrQ58rI6TXo3tz0 dMzBYtZtasRPKccn8FD0JUS1atxRTsCBtRZabbdmmDBGLzd+u2oCNWaQI5yTqtYiaYvr kGE49wkflKXT8fAXWtypkK4azDQVGenaUgJLdFJkJ+gPDEBljn+ZOUzZkvolNxH9BwCS MFbMn73ZMF/1DiXBhmphk0RQysnIViFiUkqSnhRiNFldKfs3zKJYkB0riNp0w7JS7+Sa lqKfuJBubdG+3TDlF2fIaE0mGE1qsAVCotu0aRMm0YB31QkbZR2HA3Qm1hlAuENWSPGe TSgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UPCMhPfC; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-207877-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207877-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 a640c23a62f3a-a6c80708da9si453843366b.616.2024.06.10.01.56.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 01:56:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-207877-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=@redhat.com header.s=mimecast20190719 header.b=UPCMhPfC; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-207877-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-207877-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.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 A41771F215C0 for ; Mon, 10 Jun 2024 08:56:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 37BD16F313; Mon, 10 Jun 2024 08:56:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="UPCMhPfC" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 40138558A0 for ; Mon, 10 Jun 2024 08:56:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718009772; cv=none; b=SdIbNh5P6GA9452hM0dVtFxrINyGqUWC3wqBCu1ed5FT6pJr8bVDMxsqL9vUQbHld2N+0eYO4VE26umkQQauz9USDQrZn/e1mJJcP2T0pNenfH9oWuhcejJ2ka3klmkpgtMHlqPCshXLBJOuTcHs1jdqQ1jWy+39VLcvepHfqYY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718009772; c=relaxed/simple; bh=4X3NzY/0G9gnq5hEYrDAdraQf2at+G7MFAtOMz5dTUQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=mFc2AwhHthSS88nMWB00PXp1u8JvO8wqB40JheEoijPyz2btthUlbjk+auGr+jtkTft6CPFT5OpRS1vqc5rSfynq/J/Q33oe8MfJ35gu5VS/pr7OHqGOwJppOR+ma36l6boP/122DNs6aXNmIYGQT+7raU3vCU0YPe7MujZn0qE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=UPCMhPfC; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718009769; h=from:from: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:autocrypt:autocrypt; bh=K7xP27zKqY4v47zLxGRsdu26ar7Ig8tqaIa+76/1NNg=; b=UPCMhPfCHtURhvB5Qax91K1kgjpRGhV4XzGnC0m2olSpu3F/gEnYnYl77A9ER/84nmDeII 6mBGxmUAVnQlCE0H3U0tONiks1M/S+16h6Hg569P29VTER+o6WoUOBORoJWw/+RJGQNwNG oX3vHiF7yxSB4AtB243mIb+Kg3E0MQY= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-622-QAyXn7H4OBKlHevYHjuNIg-1; Mon, 10 Jun 2024 04:56:05 -0400 X-MC-Unique: QAyXn7H4OBKlHevYHjuNIg-1 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-421f3b7b27eso4400355e9.1 for ; Mon, 10 Jun 2024 01:56:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718009764; x=1718614564; h=content-transfer-encoding:in-reply-to:organization:autocrypt :content-language:from:references:cc:to:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=K7xP27zKqY4v47zLxGRsdu26ar7Ig8tqaIa+76/1NNg=; b=K7iSFHjgbDIkS0mf9PT4rvvjPE0Qj1M8VGBkx9uMep12UsqhOa1iwuXVlHs8G7lLYf UlgUkYnb0DRJPGHqUjxTaRT6W/7BpJJcd912EFhhcG1Gr1rag/0Zc71rkZwWDOvX2CMf iLSiu46LcnGqJu3od9JCdrpNvt45WRqNBi0hFuxrbnCLAIwUAAO4ZhFdBuulMT2aLZMc VLTnzdw4GWY+AuBzTOSRBX7vujsQ21mQ0/PJLOXIKbfh8SglMFNthJ16iCNWRNKxa5G9 TI9GrxMmlrqYHqFxWt1gez/UnGbi243e3qvcXf/W2tg7HwqdBFkG0fYDBWdjW55a2DOG 4kiA== X-Gm-Message-State: AOJu0Ywnq1LJyRo1ufJH6FMsUiyOSpKcKab6AYAlbNjKGcimaOFZj3jd FeryqBV2JFetOZQpDuvx6KdQO3365NgEIEcyJGr9aiPvhC+7XLlDduAAp6m/LYdtO5ddpQg0cvF ehOeB8H4KwSLkbsV4JOCeSg3iyj42eNOVKGLZ9id0lomA8pd/MrfXMI6Wdtk0dw== X-Received: by 2002:a05:600c:4fc1:b0:422:aca:f87e with SMTP id 5b1f17b1804b1-4220acafc07mr8547135e9.19.1718009764155; Mon, 10 Jun 2024 01:56:04 -0700 (PDT) X-Received: by 2002:a05:600c:4fc1:b0:422:aca:f87e with SMTP id 5b1f17b1804b1-4220acafc07mr8546975e9.19.1718009763680; Mon, 10 Jun 2024 01:56:03 -0700 (PDT) Received: from ?IPV6:2a09:80c0:192:0:5dac:bf3d:c41:c3e7? ([2a09:80c0:192:0:5dac:bf3d:c41:c3e7]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-35f23c67e70sm2326824f8f.33.2024.06.10.01.56.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 10 Jun 2024 01:56:03 -0700 (PDT) Message-ID: <5d9583e1-3374-437d-8eea-6ab1e1400a30@redhat.com> Date: Mon, 10 Jun 2024 10:56:02 +0200 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 v1 2/3] mm/memory_hotplug: initialize memmap of !ZONE_DEVICE with PageOffline() instead of PageReserved() To: Oscar Salvador Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-hyperv@vger.kernel.org, virtualization@lists.linux.dev, xen-devel@lists.xenproject.org, kasan-dev@googlegroups.com, Andrew Morton , Mike Rapoport , "K. Y. Srinivasan" , Haiyang Zhang , Wei Liu , Dexuan Cui , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?UTF-8?Q?Eugenio_P=C3=A9rez?= , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Alexander Potapenko , Marco Elver , Dmitry Vyukov References: <20240607090939.89524-1-david@redhat.com> <20240607090939.89524-3-david@redhat.com> From: David Hildenbrand Content-Language: en-US Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBV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 3ecsQDv0fFJOA9ag5O3LLNk+3x3q7e0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f XpNMx/YrIMduZ2+nd9Di7o5+KIwlb2mAB9sTNHdMrXesX8eBL6T9b+MZJk+mZuPxKNVfEQMQ a5SxUEADIPQTPNvBewdeI80yeOCrN+Zzwy/Mrx9EPeu59Y5vSJOx/z6OUImD/GhX7Xvkt3kq Er5KTrJz3++B6SH9pum9PuoE/k+nntJkNMmQpR4MCBaV/J9gIOPGodDKnjdng+mXliF3Ptu6 3oxc2RCyGzTlxyMwuc2U5Q7KtUNTdDe8T0uE+9b8BLMVQDDfJjqY0VVqSUwImzTDLX9S4g/8 kC4HRcclk8hpyhY2jKGluZO0awwTIMgVEzmTyBphDg/Gx7dZU1Xf8HFuE+UZ5UDHDTnwgv7E th6RC9+WrhDNspZ9fJjKWRbveQgUFCpe1sa77LAw+XFrKmBHXp9ZVIe90RMe2tRL06BGiRZr jPrnvUsUUsjRoRNJjKKA/REq+sAnhkNPPZ/NNMjaZ5b8Tovi8C0tmxiCHaQYqj7G2rgnT0kt WNyWQQ== Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 10.06.24 06:23, Oscar Salvador wrote: > On Fri, Jun 07, 2024 at 11:09:37AM +0200, David Hildenbrand wrote: >> We currently initialize the memmap such that PG_reserved is set and the >> refcount of the page is 1. In virtio-mem code, we have to manually clear >> that PG_reserved flag to make memory offlining with partially hotplugged >> memory blocks possible: has_unmovable_pages() would otherwise bail out on >> such pages. >> >> We want to avoid PG_reserved where possible and move to typed pages >> instead. Further, we want to further enlighten memory offlining code about >> PG_offline: offline pages in an online memory section. One example is >> handling managed page count adjustments in a cleaner way during memory >> offlining. >> >> So let's initialize the pages with PG_offline instead of PG_reserved. >> generic_online_page()->__free_pages_core() will now clear that flag before >> handing that memory to the buddy. >> >> Note that the page refcount is still 1 and would forbid offlining of such >> memory except when special care is take during GOING_OFFLINE as >> currently only implemented by virtio-mem. >> >> With this change, we can now get non-PageReserved() pages in the XEN >> balloon list. From what I can tell, that can already happen via >> decrease_reservation(), so that should be fine. >> >> HV-balloon should not really observe a change: partial online memory >> blocks still cannot get surprise-offlined, because the refcount of these >> PageOffline() pages is 1. >> >> Update virtio-mem, HV-balloon and XEN-balloon code to be aware that >> hotplugged pages are now PageOffline() instead of PageReserved() before >> they are handed over to the buddy. >> >> We'll leave the ZONE_DEVICE case alone for now. >> >> Signed-off-by: David Hildenbrand > >> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c >> index 27e3be75edcf7..0254059efcbe1 100644 >> --- a/mm/memory_hotplug.c >> +++ b/mm/memory_hotplug.c >> @@ -734,7 +734,7 @@ static inline void section_taint_zone_device(unsigned long pfn) >> /* >> * Associate the pfn range with the given zone, initializing the memmaps >> * and resizing the pgdat/zone data to span the added pages. After this >> - * call, all affected pages are PG_reserved. >> + * call, all affected pages are PageOffline(). >> * >> * All aligned pageblocks are initialized to the specified migratetype >> * (usually MIGRATE_MOVABLE). Besides setting the migratetype, no related >> @@ -1100,8 +1100,12 @@ int mhp_init_memmap_on_memory(unsigned long pfn, unsigned long nr_pages, >> >> move_pfn_range_to_zone(zone, pfn, nr_pages, NULL, MIGRATE_UNMOVABLE); >> >> - for (i = 0; i < nr_pages; i++) >> - SetPageVmemmapSelfHosted(pfn_to_page(pfn + i)); >> + for (i = 0; i < nr_pages; i++) { >> + struct page *page = pfn_to_page(pfn + i); >> + >> + __ClearPageOffline(page); >> + SetPageVmemmapSelfHosted(page); > > So, refresh my memory here please. > AFAIR, those VmemmapSelfHosted pages were marked Reserved before, but now, > memmap_init_range() will not mark them reserved anymore. Correct. > I do not think that is ok? I am worried about walkers getting this wrong. > > We usually skip PageReserved pages in walkers because are pages we cannot deal > with for those purposes, but with this change, we will leak > PageVmemmapSelfHosted, and I am not sure whether are ready for that. There are fortunately not that many left. I'd even say marking them (vmemmap) reserved is more wrong than right: note that ordinary vmemmap pages after memory hotplug are not reserved! Only bootmem should be reserved. Let's take at the relevant core-mm ones (arch stuff is mostly just for MMIO remapping) fs/proc/task_mmu.c: if (PageReserved(page)) fs/proc/task_mmu.c: if (PageReserved(page)) -> If we find vmemmap pages mapped into user space we already messed up seriously kernel/power/snapshot.c: if (PageReserved(page) || kernel/power/snapshot.c: if (PageReserved(page) -> There should be no change (saveable_page() would still allow saving them, highmem does not apply) mm/hugetlb_vmemmap.c: if (!PageReserved(head)) mm/hugetlb_vmemmap.c: if (PageReserved(page)) -> Wants to identify bootmem, but we exclude these PageVmemmapSelfHosted() on the splitting part already properly mm/page_alloc.c: VM_WARN_ON_ONCE(PageReserved(p)); mm/page_alloc.c: if (PageReserved(page)) -> pfn_range_valid_contig() would scan them, just like for ordinary vmemmap pages during hotplug. We'll simply fail isolating/migrating them similarly (like any unmovable allocations) later mm/page_ext.c: BUG_ON(PageReserved(page)); -> free_page_ext handling, does not apply mm/page_isolation.c: if (PageReserved(page)) -> has_unmovable_pages() should still detect them as unmovable (e.g., neither movable nor LRU). mm/page_owner.c: if (PageReserved(page)) mm/page_owner.c: if (PageReserved(page)) -> Simply page_ext_get() will return NULL instead and we'll similarly skip them mm/sparse.c: if (!PageReserved(virt_to_page(ms->usage))) { -> Detecting boot memory for ms->usage allocation, does not apply to vmemmap. virt/kvm/kvm_main.c: if (!PageReserved(page)) virt/kvm/kvm_main.c: return !PageReserved(page); -> For MMIO remapping purposes, does not apply to vmemmap > Moreover, boot memmap pages are marked as PageReserved, which would be > now inconsistent with those added during hotplug operations. Just like vmemmap pages allocated dynamically during memory hotplug. Now, really only bootmem-ones are PageReserved. > All in all, I feel uneasy about this change. I really don't want to mark these pages here PageReserved for the sake of it. Any PageReserved user that I am missing, or why we should handle these vmemmap pages differently than the ones allocated during ordinary memory hotplug? In the future, we might want to consider using a dedicated page type for them, so we can stop using a bit that doesn't allow to reliably identify them. (we should mark all vmemmap with that type then) Thanks! -- Cheers, David / dhildenb