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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95079C83038 for ; Tue, 1 Jul 2025 07:58:24 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4bWb4b17chz2y2B; Tue, 1 Jul 2025 17:58:23 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1751356703; cv=none; b=eCNMKNhQGq6l5l1+NBH0+dSsZ/3U9ZjC054BZZjxW62ePEfLNH/V+vX2SmXOMtAQoiDzhFtLeHLNu/MO8TrnVhNsMEVT4eq1TblU6cFZB/FCSzk3vrHz/mHDQywtU21SUHtlCRPxdlhkx4SO40aqkBH70zgP90GXcPdlTeAtNR1UlR8eAO3lkrMPg6CnzuKan2/SYhZrqmrZ9nQ4T/kLoaW2YXjP+rYgXlideudpqcMa5jo6kX4UGoIttEw1Q3+B33XFm2Ojk37In7oLfmXuwWq4EVZG3aNm4VnIhhCdiDp+zOdZg+sA+mxWuaoM80djHJsMqWKWI9RmWW7MBjjf6A== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1751356703; c=relaxed/relaxed; bh=/Feq4JYZa9imSCNgZMBn1vPhrRu0fqByvVFyCsbFbfo=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=i8wnoMBstN+bfSVKIbD84Ao5mdIX0lpGlOH1EsGcKnU01uWIoDNaAy6VBul/y0L9GAjKBvkKlyI5EdxqruVRiUxaVlYEOvTf7U4uQBUok2Sev4Y4QHOxU9JqEg/2WmM3A8AMtpoQgEhSWUxqjw9o9lYUJjheLHuiuF1HpN98hkvM/Uw3ULxOStcLVnCMzo74kcp0Wd9/qjfimUQPcAeZFnT45h4kAs6mFS8HcZJEQZaNwnvNa87L5otvWW7buHROQg8nqHNeFcis6rXbLdpmblP/dh0iQgeMBCAdwhGzH8L+s6AGwELKkhnnFLCNdzDib5ayodAZa660xO0/xLkdAg== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YHbIKQw4; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YHbIKQw4; dkim-atps=neutral; spf=pass (client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=david@redhat.com; receiver=lists.ozlabs.org) smtp.mailfrom=redhat.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YHbIKQw4; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=YHbIKQw4; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=170.10.133.124; helo=us-smtp-delivery-124.mimecast.com; envelope-from=david@redhat.com; receiver=lists.ozlabs.org) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4bWb4Y40Yyz2xHT for ; Tue, 1 Jul 2025 17:58:19 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751356696; 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=/Feq4JYZa9imSCNgZMBn1vPhrRu0fqByvVFyCsbFbfo=; b=YHbIKQw4BLsS3XRO43mx/k1QcZuaaufnez4AumpVvxY1m3gOObsY+MezYYx5AveaE8x4RE /lXhYHKIbecMXvEI8wXpfx1jJ5ToY5XIypUSjwzPuBNoRhP/UV+6rQ+jGg49a5VIfg56a6 eMwqEgas3OTd02TamVCNxYJnTMB/2gg= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1751356696; 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=/Feq4JYZa9imSCNgZMBn1vPhrRu0fqByvVFyCsbFbfo=; b=YHbIKQw4BLsS3XRO43mx/k1QcZuaaufnez4AumpVvxY1m3gOObsY+MezYYx5AveaE8x4RE /lXhYHKIbecMXvEI8wXpfx1jJ5ToY5XIypUSjwzPuBNoRhP/UV+6rQ+jGg49a5VIfg56a6 eMwqEgas3OTd02TamVCNxYJnTMB/2gg= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-194-0STs5SidPJqGpkgYEP67cA-1; Tue, 01 Jul 2025 03:58:14 -0400 X-MC-Unique: 0STs5SidPJqGpkgYEP67cA-1 X-Mimecast-MFC-AGG-ID: 0STs5SidPJqGpkgYEP67cA_1751356693 Received: by mail-wr1-f69.google.com with SMTP id ffacd0b85a97d-3a523ce0bb2so1624532f8f.0 for ; Tue, 01 Jul 2025 00:58:14 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1751356693; x=1751961493; 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=/Feq4JYZa9imSCNgZMBn1vPhrRu0fqByvVFyCsbFbfo=; b=fCfF45oGDJ6/gp41TFNnXEapCfOr2V5MLibA3M2AJ4MAABdqabr2WSb4OVARL+cqyL CVMFLozKEiVajliBMNuPpatETkBt2JsV5xOMwc0AilK2qP2HkraPAkDavEwP/V6nDLj+ gLvazo13MiPKuUxGQa53LMgn2EdkyTbUIcGwGvu1H2v7Y2n0CdiY0JptEvNhJtrIlgUV iQuVXAFpFfKe2WdxWcckNW7qiorx5mY9uVdJ9MD+snklWgQjWwr/y0dQ9veO7fL2CrIz pKCtagdQ/Hhm/i/6tQzyWoHRT/vd1vpq4ZnVmdWHVuzHVQTN+FvGlmF6sUTM7kPsMQF7 ps1w== X-Forwarded-Encrypted: i=1; AJvYcCWAqXm5nyvb+5D+feRel+8cDQ4YG9YBhK8zn26EuiwTsYEENf9vWjP4nZhVObPxo2rPsK1yLwTRTlLCbME=@lists.ozlabs.org X-Gm-Message-State: AOJu0YwpIGQzdi3hm/x0GbB9840u3nsgoRWuDu0BzPkuL5pdH5e9lOo4 tMoy78pObymhuI7OJm+tHi0RnuZP6rM07s6Kxo8X+83LAEQvhLVcupnetel70ODmviAktiajFTb yXSEJ6/NoZoYUoR15YtnevtGknYsSzYbSfk5XNVMiZCuqtxQcgKZgAEFROgks8Dr3ktw= X-Gm-Gg: ASbGncsMqV8pwa6aPGTPrdyKLKDqVWLfNiQH80/HjTu7Ja1yPFFDvlbkhqU+JfW3j41 JAXDu1BvJflqVvMIyIiCBKtNLkFwxF3Y1vcRSkUzSuTy7OsKvij2qp49FWczKJWR3q9CxpHihpI YtfWFOeyYK66J+POJjf22KkTEkaV58JPNClovwwyxiI++xu2SMZ8F8zw9b9Ael495x6l/o9XQw5 DFAZCtdueoYRqUKuCFcVODFkQ8mC4S+OIk5DSaT2ilZdvLGJ/EuSo6NpQxfEpILN/EGI6igRUsB gfhpIIE5sEVItHsRy1Pqz4c37D9U6iBQ9DT27zyHOngcbymSG8b/NAn2/DL16NyKRfgl9iSgyUX IjnU6cBzZpXnpEf6UifZ0zjctDe54LJhTQ7yN9wEk5+WJWRuTMA== X-Received: by 2002:a05:6000:64b:b0:3a6:d5fd:4687 with SMTP id ffacd0b85a97d-3a8f482bd31mr13154724f8f.18.1751356693301; Tue, 01 Jul 2025 00:58:13 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGjMbemhkIZeoSup+OwONMSvz50yZg2K0dN6tNDQHYUqndeAp7nP+ltTQxgNLFcEg/amFhAAA== X-Received: by 2002:a05:6000:64b:b0:3a6:d5fd:4687 with SMTP id ffacd0b85a97d-3a8f482bd31mr13154650f8f.18.1751356692689; Tue, 01 Jul 2025 00:58:12 -0700 (PDT) Received: from ?IPV6:2003:d8:2f18:7500:202e:b0f1:76d6:f9af? (p200300d82f187500202eb0f176d6f9af.dip0.t-ipconnect.de. [2003:d8:2f18:7500:202e:b0f1:76d6:f9af]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-3a88c7e72c1sm12366971f8f.1.2025.07.01.00.58.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Jul 2025 00:58:11 -0700 (PDT) Message-ID: <277e094d-b159-411f-940d-13b62493f6c5@redhat.com> Date: Tue, 1 Jul 2025 09:58:09 +0200 X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v1 02/29] mm/balloon_compaction: convert balloon_page_delete() to balloon_page_finalize() To: Lorenzo Stoakes Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, virtualization@lists.linux.dev, linux-fsdevel@vger.kernel.org, Andrew Morton , Jonathan Corbet , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Christophe Leroy , Jerrin Shaji George , Arnd Bergmann , Greg Kroah-Hartman , "Michael S. Tsirkin" , Jason Wang , Xuan Zhuo , =?UTF-8?Q?Eugenio_P=C3=A9rez?= , Alexander Viro , Christian Brauner , Jan Kara , Zi Yan , Matthew Brost , Joshua Hahn , Rakie Kim , Byungchul Park , Gregory Price , Ying Huang , Alistair Popple , "Liam R. Howlett" , Vlastimil Babka , Mike Rapoport , Suren Baghdasaryan , Michal Hocko , "Matthew Wilcox (Oracle)" , Minchan Kim , Sergey Senozhatsky , Brendan Jackman , Johannes Weiner , Jason Gunthorpe , John Hubbard , Peter Xu , Xu Xin , Chengming Zhou , Miaohe Lin , Naoya Horiguchi , Oscar Salvador , Rik van Riel , Harry Yoo , Qi Zheng , Shakeel Butt References: <20250630130011.330477-1-david@redhat.com> <20250630130011.330477-3-david@redhat.com> From: David Hildenbrand Autocrypt: addr=david@redhat.com; keydata= xsFNBFXLn5EBEAC+zYvAFJxCBY9Tr1xZgcESmxVNI/0ffzE/ZQOiHJl6mGkmA1R7/uUpiCjJ dBrn+lhhOYjjNefFQou6478faXE6o2AhmebqT4KiQoUQFV4R7y1KMEKoSyy8hQaK1umALTdL QZLQMzNE74ap+GDK0wnacPQFpcG1AE9RMq3aeErY5tujekBS32jfC/7AnH7I0v1v1TbbK3Gp XNeiN4QroO+5qaSr0ID2sz5jtBLRb15RMre27E1ImpaIv2Jw8NJgW0k/D1RyKCwaTsgRdwuK Kx/Y91XuSBdz0uOyU/S8kM1+ag0wvsGlpBVxRR/xw/E8M7TEwuCZQArqqTCmkG6HGcX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0uo06XMaY7UHS341ozXUUI7wC7iKfoUTv03iO9El5f 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: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 45JMk8ahgaLz__HlgdJD2feim0j7b6yCZNFoox8D6To_1751356693 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 30.06.25 17:15, Lorenzo Stoakes wrote: > On Mon, Jun 30, 2025 at 02:59:43PM +0200, David Hildenbrand wrote: >> Let's move the removal of the page from the balloon list into the single >> caller, to remove the dependency on the PG_isolated flag and clarify >> locking requirements. >> >> We'll shuffle the operations a bit such that they logically make more sense >> (e.g., remove from the list before clearing flags). >> >> In balloon migration functions we can now move the balloon_page_finalize() >> out of the balloon lock and perform the finalization just before dropping >> the balloon reference. >> >> Document that the page lock is currently required when modifying the >> movability aspects of a page; hopefully we can soon decouple this from the >> page lock. >> >> Signed-off-by: David Hildenbrand >> --- >> arch/powerpc/platforms/pseries/cmm.c | 2 +- >> drivers/misc/vmw_balloon.c | 3 +- >> drivers/virtio/virtio_balloon.c | 4 +-- >> include/linux/balloon_compaction.h | 43 +++++++++++----------------- >> mm/balloon_compaction.c | 3 +- >> 5 files changed, 21 insertions(+), 34 deletions(-) >> >> diff --git a/arch/powerpc/platforms/pseries/cmm.c b/arch/powerpc/platforms/pseries/cmm.c >> index 5f4037c1d7fe8..5e0a718d1be7b 100644 >> --- a/arch/powerpc/platforms/pseries/cmm.c >> +++ b/arch/powerpc/platforms/pseries/cmm.c >> @@ -532,7 +532,6 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info, >> >> spin_lock_irqsave(&b_dev_info->pages_lock, flags); >> balloon_page_insert(b_dev_info, newpage); >> - balloon_page_delete(page); > Hi Lorenzo, as always, thanks for the detailed review! > We seem to just be removing this and not replacing with finalize, is this right? See below. > >> b_dev_info->isolated_pages--; >> spin_unlock_irqrestore(&b_dev_info->pages_lock, flags); >> >> @@ -542,6 +541,7 @@ static int cmm_migratepage(struct balloon_dev_info *b_dev_info, >> */ >> plpar_page_set_active(page); >> >> + balloon_page_finalize(page); ^ here it is, next to the put_page() just like for the other cases. Or did you mean something else? >> /* balloon page list reference */ >> put_page(page); >> >> diff --git a/drivers/misc/vmw_balloon.c b/drivers/misc/vmw_balloon.c >> index c817d8c216413..6653fc53c951c 100644 >> --- a/drivers/misc/vmw_balloon.c >> +++ b/drivers/misc/vmw_balloon.c >> @@ -1778,8 +1778,7 @@ static int vmballoon_migratepage(struct balloon_dev_info *b_dev_info, >> * @pages_lock . We keep holding @comm_lock since we will need it in a >> * second. >> */ >> - balloon_page_delete(page); >> - >> + balloon_page_finalize(page); >> put_page(page); >> [...] >> -/* >> - * balloon_page_delete - delete a page from balloon's page list and clear >> - * the page->private assignement accordingly. >> - * @page : page to be released from balloon's page list >> - * >> - * Caller must ensure the page is locked and the spin_lock protecting balloon >> - * pages list is held before deleting a page from the balloon device. >> - */ >> -static inline void balloon_page_delete(struct page *page) >> -{ >> - __ClearPageOffline(page); >> - __ClearPageMovable(page); >> - set_page_private(page, 0); >> - /* >> - * No touch page.lru field once @page has been isolated >> - * because VM is using the field. >> - */ >> - if (!PageIsolated(page)) >> - list_del(&page->lru); > > I don't see this check elsewhere, is it because, as per the 1/xx of this series, > because by the time we do the finalize balloon_page_delete() was used on two paths 1) Removing a page from the balloon for deflation through balloon_page_list_dequeue() 2) Removing an isolated page from the balloon for migration in the per-driver migration handlers. Isolated pages were already removed from the balloon list during ... isolation. With this change, 1) does the list_del(&page->lru) manually and 2) only calls balloon_page_finalize(). During 1) the same reasoning as in 1/xx applies: isolated pages cannot be in the balloon list. > >> -} >> - >> /* >> * balloon_page_device - get the b_dev_info descriptor for the balloon device >> * that enqueues the given page. >> @@ -141,12 +120,6 @@ static inline void balloon_page_insert(struct balloon_dev_info *balloon, >> list_add(&page->lru, &balloon->pages); >> } >> >> -static inline void balloon_page_delete(struct page *page) >> -{ >> - __ClearPageOffline(page); >> - list_del(&page->lru); >> -} >> - >> static inline gfp_t balloon_mapping_gfp_mask(void) >> { >> return GFP_HIGHUSER; >> @@ -154,6 +127,22 @@ static inline gfp_t balloon_mapping_gfp_mask(void) >> >> #endif /* CONFIG_BALLOON_COMPACTION */ >> >> +/* >> + * balloon_page_finalize - prepare a balloon page that was removed from the >> + * balloon list for release to the page allocator >> + * @page: page to be released to the page allocator >> + * >> + * Caller must ensure that the page is locked. > > Can we assert this? We could, but I'm planning on removing the page lock next (see patch description), so not too keen to create more code around that. Maybe mention that the balloon lock should not be held? Not a limitation. It could be called with it, just not a requirement today. I suspect that once we remove the page lock, that we might use the balloon lock and rework balloon_page_migrate() to take the lock. TBD. > >> + */ >> +static inline void balloon_page_finalize(struct page *page) >> +{ >> + if (IS_ENABLED(CONFIG_BALLOON_COMPACTION)) { >> + __ClearPageMovable(page); >> + set_page_private(page, 0); >> + } > > Why do we check this? Is this function called from anywhere where that config won't be set? Sure. balloon_page_list_dequeue() is called from balloon_page_dequeue(), which resides outside the CONFIG_BALLOON_COMPACTION ifdef in mm/balloon_compaction.c. At some point (not in this series) we should probably rename balloon_compaction.c -> balloon.c To match CONFIG_MEMORY_BALLOON. Because the compaction part is just one extra bit in there. (an important one, but still, you can use the balloon infrastructure without compaction/page migration) -- Cheers, David / dhildenb