Received: by 2002:ab2:69cc:0:b0:1fd:c486:4f03 with SMTP id n12csp188487lqp; Tue, 11 Jun 2024 01:01:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUFMIUVcTmNf7QBeW59kqLNdS/pASVNIdrrdhhxQ/1vV01yNwzbe4U0oy51eKEU0hKestaLdSsosphn7dpelu9n5jlc2gkbr2r+D5e9iA== X-Google-Smtp-Source: AGHT+IHX0FnhkUywmD06gAwNrMWukQZXb5UUvT6p+0ZPYP4WCrq/pr8coiKTbphQ1hKit4ZHC1gB X-Received: by 2002:a17:906:d7a2:b0:a6e:fe01:18cf with SMTP id a640c23a62f3a-a6efe011a09mr531625766b.25.1718092878363; Tue, 11 Jun 2024 01:01:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718092878; cv=pass; d=google.com; s=arc-20160816; b=fmS9eikyepVtAl5HdaoAqhWZDQ4yHf9y+QpAvvtwijBL9ChrSh944YiAOrF/2lWnU2 7F/hff/N5+Kud28A8Wjnw0Ma98lJvBYHaQfzuWz7DXpsStgYc9RtCKB61I4ObowyRO9z 89h3ClL15GO4dveCiG5vJC8LnVnFEKJfZntEuDuGCxBWSxSb538+5Z67DjhadLp8rEXR qAI+Cf4aCcdjGwuROenEobHWbNlGzP6kcmbDJrVdTg9xWMng3BSpNiY46WfgiCMk6TS/ oACQQNFlcDkH/TGtFX3ikda6stlXyw7DCDYbFGlUGVwrmy6Mejf7WykjHTQs4SHuieCj TKOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature:dkim-signature:dkim-signature :dkim-signature; bh=qHTLyIX7jLzbH1ivzBIljZd8gbAzcrr4kki4IuM/w4s=; fh=opXV1WEp03kbeubOZloyb10FoNtntQdRllRWblbVMRI=; b=F5Vb7TgRv2U5u1kLo9yVpT3wn3U0yGslrzpY+TB6wHgSuonTepCxMO6XUvoQ1QqSrp qnwqEU5m951TGiWZ8QUhKAljwrTBnJt7EQTJ+3nTvcVNkpkmLxGwTNV8G4Rxte8ZaLSR 9kS+lW3SA4CpmpTrwqK+Rqy9epSqk3FcEgnP0ULM42Mn4fKZaU/VUYo8YXdNGgA4j3cA D/xeOqW0aIJ7O/1Wj4+OaNGa8l40wZPp7wMVpeQ00vIHOM2YKOWHbO/RryQiHd7SQjYM EL/d/g35YbZ2v9ZGA91gLxH9X0w91+06O+EInjOJp+ckDGvn9VGE+Z761iBeIAIWqkks 74Ug==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=eZBr7hv0; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=eZBr7hv0; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-209438-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209438-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-57c765240dasi2486580a12.187.2024.06.11.01.01.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 01:01:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-209438-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=eZBr7hv0; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=eZBr7hv0; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; arc=pass (i=1 spf=pass spfdomain=suse.de dkim=pass dkdomain=suse.de dkim=pass dkdomain=suse.de dmarc=pass fromdomain=suse.de); spf=pass (google.com: domain of linux-kernel+bounces-209438-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-209438-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de 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 E80241F218AB for ; Tue, 11 Jun 2024 08:01:17 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 717E4173323; Tue, 11 Jun 2024 08:01:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="eZBr7hv0"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="OXxCJyUQ"; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="eZBr7hv0"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="OXxCJyUQ" Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.223.131]) (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 10F2E7C09E; Tue, 11 Jun 2024 08:01:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=195.135.223.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718092868; cv=none; b=BqDEluSPdIXKrSd6A8j0g926L7Bd5hFIguwfHfGx21kq1BQVQOf+ed2up6e/FXMjjNwzHAFJcUPSNvU8vfXScyKvBVp/egzeJyqmOKNxzCspEQN6ESNlvbzTWwVzfNGUvbLwV7v3/XvE1pBLcIA4oDnWsbZfOFESjB7NHCTQc4A= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718092868; c=relaxed/simple; bh=jwJHq+vd5L6MZDnMuM4jQ8vcoW0y342FZpLncBEsrc8=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Wm8+JqCrV/eA5y1YFa36lKoxLBMcGbqP28xYvj/T0k7BFKosq2VhkTL79ABOsi+S44vTkKgK5U8mYqUKqn0z7PL+qhMW/6z0nat+JeLubp/gyzo9aC8l1Fv3DnwPnlyedqPjj2Yknge//JmHxNjbHvxLwM8u8ZZuKKBjE1kk/s4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de; spf=pass smtp.mailfrom=suse.de; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=eZBr7hv0; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=OXxCJyUQ; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b=eZBr7hv0; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b=OXxCJyUQ; arc=none smtp.client-ip=195.135.223.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.de 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== Authentication-Results: smtp-out2.suse.de; none 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> 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: <20240607090939.89524-3-david@redhat.com> X-Spam-Level: X-Spamd-Result: default: False [-4.26 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.16)[-0.822]; MIME_GOOD(-0.10)[text/plain]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; MISSING_XM_UA(0.00)[]; RCPT_COUNT_TWELVE(0.00)[23]; SUBJECT_HAS_EXCLAIM(0.00)[]; RCVD_TLS_ALL(0.00)[]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FROM_EQ_ENVFROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,suse.de:email] X-Spam-Score: -4.26 X-Spam-Flag: NO 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