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 AD70BC25B76 for ; Tue, 11 Jun 2024 08:01:10 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E6916B0099; Tue, 11 Jun 2024 04:01:10 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 197776B009A; Tue, 11 Jun 2024 04:01:10 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 0100B6B009B; Tue, 11 Jun 2024 04:01:09 -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 D72526B0099 for ; Tue, 11 Jun 2024 04:01:09 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 58AC0C1355 for ; Tue, 11 Jun 2024 08:01:09 +0000 (UTC) X-FDA: 82217862258.08.9AED9FA Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) by imf06.hostedemail.com (Postfix) with ESMTP id DCFC018001A for ; Tue, 11 Jun 2024 08:01:06 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=eZBr7hv0; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=OXxCJyUQ; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=eZBr7hv0; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=OXxCJyUQ; spf=pass (imf06.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1718092867; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=qHTLyIX7jLzbH1ivzBIljZd8gbAzcrr4kki4IuM/w4s=; b=K6/vvTt23hELt6f3M4Amv246SZtO620EEvdSS77XkchKjnjiljI2AG5D1Af2F9gWFgCfvb +AxOc2egc9HfB5a7cDZv8Sxzwy8BweMwYhlCPyoLRhRdlfHQ/xQps49cLrJF995P9/SAFf 2lpCWORpsTDUyFHb4eUtTINGZZ/adH0= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=eZBr7hv0; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=OXxCJyUQ; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=eZBr7hv0; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=OXxCJyUQ; spf=pass (imf06.hostedemail.com: domain of osalvador@suse.de designates 195.135.223.131 as permitted sender) smtp.mailfrom=osalvador@suse.de; dmarc=pass (policy=none) header.from=suse.de ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1718092867; a=rsa-sha256; cv=none; b=GCef8br2hzha25W4MXYOqvFYP7t9I/AVL1wESUl1FbZ9lj7uEenJZevQRxbySX3v1P+mcZ 2QWAIB+NJk0pM1kAETCZKNhj8Dh2xlGtFQc72ZDZMLSDyKLwKuQNPvuHjpOBr8npfwhwnT 4UjlhaPuvXK0MPdhFRJWcNvDivAueeU= Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 3DCEE20560; Tue, 11 Jun 2024 08:01:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718092865; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qHTLyIX7jLzbH1ivzBIljZd8gbAzcrr4kki4IuM/w4s=; b=eZBr7hv01QtJAQ63m8FhIkoxR6rfVWdIAtAM3tMSW7+msYF8sKzstxlxUcLGVQkzYd+xcg yOUDCjNkttpZD4LSyjDGBE0HLudW2/1+Hz5TvpMX2H9pqAKeYuboG4MyCcVVBme6zH6ZFU gW3gI5sxhgleQef05pj0FqPwwOu6HPU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718092865; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qHTLyIX7jLzbH1ivzBIljZd8gbAzcrr4kki4IuM/w4s=; b=OXxCJyUQRJS9OhqC4VgzbBVBP3JyYprOS8XwZTJXMp2JoR9G+H5IoGoPm1Pm1PuGPVCFI5 a/T9/prPxYrogmCQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718092865; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qHTLyIX7jLzbH1ivzBIljZd8gbAzcrr4kki4IuM/w4s=; b=eZBr7hv01QtJAQ63m8FhIkoxR6rfVWdIAtAM3tMSW7+msYF8sKzstxlxUcLGVQkzYd+xcg yOUDCjNkttpZD4LSyjDGBE0HLudW2/1+Hz5TvpMX2H9pqAKeYuboG4MyCcVVBme6zH6ZFU gW3gI5sxhgleQef05pj0FqPwwOu6HPU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718092865; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=qHTLyIX7jLzbH1ivzBIljZd8gbAzcrr4kki4IuM/w4s=; b=OXxCJyUQRJS9OhqC4VgzbBVBP3JyYprOS8XwZTJXMp2JoR9G+H5IoGoPm1Pm1PuGPVCFI5 a/T9/prPxYrogmCQ== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 2124F13A55; Tue, 11 Jun 2024 08:01:04 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id cdtzBUAEaGY4VgAAD6G6ig (envelope-from ); Tue, 11 Jun 2024 08:01:04 +0000 Date: Tue, 11 Jun 2024 10:01:02 +0200 From: Oscar Salvador To: David Hildenbrand 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 , Eugenio =?iso-8859-1?Q?P=E9rez?= , Juergen Gross , Stefano Stabellini , Oleksandr Tyshchenko , Alexander Potapenko , Marco Elver , Dmitry Vyukov Subject: Re: [PATCH v1 2/3] mm/memory_hotplug: initialize memmap of !ZONE_DEVICE with PageOffline() instead of PageReserved() Message-ID: References: <20240607090939.89524-1-david@redhat.com> <20240607090939.89524-3-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240607090939.89524-3-david@redhat.com> X-Rspamd-Queue-Id: DCFC018001A X-Rspam-User: X-Rspamd-Server: rspam09 X-Stat-Signature: awk9tqbjodky9n1tyu8cwq1ktx7r839r X-HE-Tag: 1718092866-655275 X-HE-Meta: U2FsdGVkX1/oOC1JkxXH65AqzoSuOdHmt9XJA/kLrThS5AQ5FERpHj8czkL6rtQFJ5lJKkRc/70VC9yTl+aTfk/R7v+ZV/XgWX7P5chcWrnTsbHCqY1GkV++/s0eUxARsMPatUUEUVrSCX+3wco/UL9YqUemCTvh5de6BXWwS6qIMJ+gxtyd2Am4VULuTkhlgigRiXnvUdgy+4mohD/AEOokh2DEBwGyEko0CPnkmLaanzVZkZBWZgPEFhDyoN4+JYSPpCfKkriCNv5pmc4x3Jccti97H9hStBLQChdnjLAlX/52gIYdrQ90Pmb4ZmuSskBKkLIRKYn6e/KfQGYM7cutfi8KdpoaeumP436CyVZRtuoEL82IFFtPacBic3idMtKM5fQ3CscQaq/d/GthVB6UTETmbNcvPrdxpkClw4V3RRTmdJdGbK+9JOXVqbYwE/uZMFQUayQP1TZyji4e4abys05ZdbCVpy7vBs6jnt7xq2ZEsFv7VyhPIg76K9z8PBD5eIQucD3hhqjv12jxVszqW9IwwYlPP/C7YmEjbyz/fK1peFyev5H2Ni2kByA15nhXd3hmttAfSiH4n4Sv63sQX4/RtjxvrH8tmZnK5R1i7jXfgGsZHmNi1jytUMKlEHao+kgTZHcMPzS3WfflahsojWhTzBTuOT9EJMyEmQrFPVRcD9U7i3G2/QPongTbI/HSDxr712zHBoOwT3nDjSi66FrFHMB5R/cNC8M13FFr77cT0SIeuY8Cf99UyxZSXh971f9t2fv6IxALRisaAk1JT/2jaTVJWdw7sRiwgwQzuXyR5nlpInjQKYDIhjvdSxvtOOzRO9V9rglNXiqXcvrJ9Y9V9sAfZGTGEoOnCJY/2TTswt45bNGkm/NKiaQW/CHoc2sksqT+WOY301MsfD+WoaKLkJcQDkTesOVEmBFBOpIA3xj7JtjgDBuQ30Qn49tgqjAbRwNNg3rauTb Jfvo1te+ Rs8dIMKDeStHZtCxDBUp+KkzpNoNJ401LGk2l+V6NzKBSen+Wj8HjfQ7/AyxxbqJhfXGuKFpfrnOuk8hWH1WDceMmWrRaay3uGLwVpi9XamseewJp6aRrWb3M8f5LMrnbZzER3AM2cZvv5nAC8C6t+mQgjA/0Z4LbKG32rBNqeP9HherzjmtKo+4m7r1TBn3xwV+8Jf7FZV7TPQj+h85mOtXLWmlGpzkgKAErocpH/D+e0RapObUrWuwbncHGTAABnFMTEo6KfmpNkC/7hwVbh5/GU3Lo7WncLkV46Slkboeg0VMX/BXJHgjBLnCVVI0ucMFZ 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 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 Acked-by: Oscar Salvador # for the generic memory-hotplug bits -- Oscar Salvador SUSE Labs