lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 15 Feb 2024 15:04:02 -0500
From: Zi Yan <ziy@...dia.com>
To: Vlastimil Babka <vbabka@...e.cz>
Cc: linux-mm@...ck.org, linux-kernel@...r.kernel.org,
 "\"Huang, Ying\"" <ying.huang@...el.com>,
 Ryan Roberts <ryan.roberts@....com>,
 Andrew Morton <akpm@...ux-foundation.org>,
 "\"Matthew Wilcox (Oracle)\"" <willy@...radead.org>,
 David Hildenbrand <david@...hat.com>,
 "\"Yin, Fengwei\"" <fengwei.yin@...el.com>, Yu Zhao <yuzhao@...gle.com>,
 "\"Kirill A . Shutemov\"" <kirill.shutemov@...ux.intel.com>,
 Johannes Weiner <hannes@...xchg.org>,
 Baolin Wang <baolin.wang@...ux.alibaba.com>,
 Kemeng Shi <shikemeng@...weicloud.com>,
 Mel Gorman <mgorman@...hsingularity.net>,
 Rohan Puri <rohan.puri15@...il.com>, Mcgrof Chamberlain <mcgrof@...nel.org>,
 Adam Manzanares <a.manzanares@...sung.com>,
 "\"Vishal Moola (Oracle)\"" <vishal.moola@...il.com>
Subject: Re: [PATCH v5 2/3] mm/compaction: add support for >0 order folio
 memory compaction.

On 15 Feb 2024, at 15:02, Vlastimil Babka wrote:

> On 2/15/24 18:32, Zi Yan wrote:
>> On 15 Feb 2024, at 11:57, Vlastimil Babka wrote:
>>
>>> On 2/14/24 23:04, Zi Yan wrote:
>>>> @@ -1849,10 +1857,22 @@ static struct folio *compaction_alloc(struct folio *src, unsigned long data)
>>>>  static void compaction_free(struct folio *dst, unsigned long data)
>>>>  {
>>>>  	struct compact_control *cc = (struct compact_control *)data;
>>>> +	int order = folio_order(dst);
>>>> +	struct page *page = &dst->page;
>>>> +
>>>> +	if (folio_put_testzero(dst)) {
>>>> +		free_pages_prepare_fpi_none(page, order);
>>>> +
>>>> +		INIT_LIST_HEAD(&dst->lru);
>>>
>>> (is this even needed? I think the state of first parameter of list_add() is
>>> never expected to be in particular state?)
>>
>> There is a __list_add_valid() performing list corruption checks.
>
> Yes, but dst->lru becomes "new" in list_add() and __list_add_valid() and
> those never check the contents of new, i.e. new->next or new->prev. We could
> have done list_del(&dst->lru) which puts poison values there and then a
> list_add() is fine. So dst->lru does not need the init, it's just confusing.
> Init is for the list's list_head, not for the list entry.

Got it. Will remove it.

>>>>
>>>> -	list_add(&dst->lru, &cc->freepages);
>>>> -	cc->nr_freepages++;
>>>> -	cc->nr_migratepages += 1 << folio_order(dst);
>>>> +		list_add(&dst->lru, &cc->freepages[order]);
>>>> +		cc->nr_freepages += 1 << order;
>>>> +		cc->nr_migratepages += 1 << order;
>>>
>>> Hm actually this increment of nr_migratepages should happen even if we lost
>>> the free page.
>>
>> Because compaction_free() indicates the page is not migrated and nr_migratepages
>> should be increased regardless.
>
> Yes.
>
>> Will fix it. Thanks.
>>
>>>> +	}
>>>> +	/*
>>>> +	 * someone else has referenced the page, we cannot take it back to our
>>>> +	 * free list.
>>>> +	 */
>>>>  }
>>
>>
>> --
>> Best Regards,
>> Yan, Zi


--
Best Regards,
Yan, Zi

Download attachment "signature.asc" of type "application/pgp-signature" (855 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ