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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <89830f41-b3f2-a158-a173-8c14101edcaa@redhat.com>
Date:   Wed, 17 Mar 2021 15:42:43 +0100
From:   David Hildenbrand <david@...hat.com>
To:     Michal Hocko <mhocko@...e.com>, Oscar Salvador <osalvador@...e.de>
Cc:     Andrew Morton <akpm@...ux-foundation.org>,
        Vlastimil Babka <vbabka@...e.cz>,
        Muchun Song <songmuchun@...edance.com>,
        Mike Kravetz <mike.kravetz@...cle.com>, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v5 1/5] mm,page_alloc: Bail out earlier on -ENOMEM in
 alloc_contig_migrate_range

On 17.03.21 15:05, Michal Hocko wrote:
> On Wed 17-03-21 12:12:47, Oscar Salvador wrote:
>> Currently, __alloc_contig_migrate_range can generate -EINTR, -ENOMEM or -EBUSY,
>> and report them down the chain.
>> The problem is that when migrate_pages() reports -ENOMEM, we keep going till we
>> exhaust all the try-attempts (5 at the moment) instead of bailing out.
>>
>> migrate_pages() bails out right away on -ENOMEM because it is considered a fatal
>> error. Do the same here instead of keep going and retrying.
> 
> I suspect this is not really a real life problem, right? The allocation
> would be more costly in the end but this is to be expected under a heavy
> memory pressure.
> 
> That being said, bailing out early makes sense to me. But now that
> you've made me look into the migrate_pages excellent error state reporting
> I suspect we have a bug here. Note the
> "Returns the number of pages that were not migrated, or an error code."
> 
> but I do not see putback_movable_pages for ret > 0 so it seems we might
> leak some pages.

At least in __alloc_contig_migrate_range() we seem to always leave the 
loop with ret <= 0 and do a putback_movable_pages() with ret < 0.

Which code are you referring to?

(I think the logic flow inside __alloc_contig_migrate_range() might be 
improved ...)

-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ