linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: Matthew Wilcox <willy@infradead.org>,
	Ryan Roberts <ryan.roberts@arm.com>
Cc: Will Deacon <will@kernel.org>,
	"Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Nick Piggin <npiggin@gmail.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Christian Borntraeger <borntraeger@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Arnd Bergmann <arnd@arndb.de>, Yu Zhao <yuzhao@google.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Yin Fengwei <fengwei.yin@intel.com>,
	Yang Shi <shy828301@gmail.com>,
	"Huang, Ying" <ying.huang@intel.com>, Zi Yan <ziy@nvidia.com>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1 4/4] mm/mmu_gather: Store and process pages in contig ranges
Date: Fri, 25 Aug 2023 09:13:35 +0200	[thread overview]
Message-ID: <75337a54-da9e-c50a-395d-1c6c93b087f8@redhat.com> (raw)
In-Reply-To: <ZOgpb1Qo5B0r+mhJ@casper.infradead.org>

On 25.08.23 06:09, Matthew Wilcox wrote:
> On Thu, Aug 10, 2023 at 11:33:32AM +0100, Ryan Roberts wrote:
>> +void folios_put_refs(struct folio_range *folios, int nr)
>> +{
>> +	int i;
>> +	LIST_HEAD(pages_to_free);
>> +	struct lruvec *lruvec = NULL;
>> +	unsigned long flags = 0;
>> +	unsigned int lock_batch;
>> +
>> +	for (i = 0; i < nr; i++) {
>> +		struct folio *folio = page_folio(folios[i].start);
>> +		int refs = folios[i].end - folios[i].start;
>> +
>> +		/*
>> +		 * Make sure the IRQ-safe lock-holding time does not get
>> +		 * excessive with a continuous string of pages from the
>> +		 * same lruvec. The lock is held only if lruvec != NULL.
>> +		 */
>> +		if (lruvec && ++lock_batch == SWAP_CLUSTER_MAX) {
>> +			unlock_page_lruvec_irqrestore(lruvec, flags);
>> +			lruvec = NULL;
>> +		}
>> +
>> +		if (is_huge_zero_page(&folio->page))
>> +			continue;
>> +
>> +		if (folio_is_zone_device(folio)) {
>> +			if (lruvec) {
>> +				unlock_page_lruvec_irqrestore(lruvec, flags);
>> +				lruvec = NULL;
>> +			}
>> +			if (put_devmap_managed_page(&folio->page))
>> +				continue;
>> +			if (folio_put_testzero(folio))
> 
> We're only putting one ref for the zone_device folios?  Surely
> this should be ref_sub_and_test like below?

I suspect put_devmap_managed_page() then also needs care?

-- 
Cheers,

David / dhildenb



  reply	other threads:[~2023-08-25  7:13 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-10 10:33 [PATCH v1 0/4] Optimize mmap_exit for large folios Ryan Roberts
2023-08-10 10:33 ` [PATCH v1 1/4] mm: Implement folio_remove_rmap_range() Ryan Roberts
2023-08-10 10:33 ` [PATCH v1 2/4] mm/mmu_gather: generalize mmu_gather rmap removal mechanism Ryan Roberts
2023-08-10 10:33 ` [PATCH v1 3/4] mm/mmu_gather: Remove encoded_page infrastructure Ryan Roberts
2023-08-10 17:34   ` Yu Zhao
2023-08-10 18:31     ` Linus Torvalds
2023-08-10 18:54       ` Ryan Roberts
2023-08-10 10:33 ` [PATCH v1 4/4] mm/mmu_gather: Store and process pages in contig ranges Ryan Roberts
2023-08-10 14:44   ` Zi Yan
2023-08-10 14:55     ` Ryan Roberts
2023-08-10 14:59       ` Zi Yan
2023-08-10 15:05         ` Ryan Roberts
2023-12-04 12:26         ` Ryan Roberts
2023-12-04 12:28           ` David Hildenbrand
2023-12-04 12:39             ` Ryan Roberts
2023-12-04 12:43               ` David Hildenbrand
2023-12-04 12:57                 ` Ryan Roberts
2023-08-25  4:09   ` Matthew Wilcox
2023-08-25  7:13     ` David Hildenbrand [this message]
2023-08-29 14:02     ` Ryan Roberts
2023-08-29 14:19       ` Matthew Wilcox
2023-08-29 14:24         ` Matthew Wilcox
2023-08-29 15:59           ` Ryan Roberts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=75337a54-da9e-c50a-395d-1c6c93b087f8@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=arnd@arndb.de \
    --cc=borntraeger@linux.ibm.com \
    --cc=fengwei.yin@intel.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@gmail.com \
    --cc=peterz@infradead.org \
    --cc=ryan.roberts@arm.com \
    --cc=shy828301@gmail.com \
    --cc=svens@linux.ibm.com \
    --cc=will@kernel.org \
    --cc=willy@infradead.org \
    --cc=ying.huang@intel.com \
    --cc=yuzhao@google.com \
    --cc=ziy@nvidia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).