lkml.org 
[lkml]   [2021]   [Mar]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    SubjectRe: [PATCH] mm: be more verbose for alloc_contig_range faliures
    On Thu 04-03-21 10:22:51, Minchan Kim wrote:
    [...]
    > How about this?
    >
    > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
    > index 238d0fc232aa..489e557b9390 100644
    > --- a/mm/page_alloc.c
    > +++ b/mm/page_alloc.c
    > @@ -8481,7 +8481,8 @@ static inline void dump_migrate_failure_pages(struct list_head *page_list)
    >
    > /* [start, end) must belong to a single zone. */
    > static int __alloc_contig_migrate_range(struct compact_control *cc,
    > - unsigned long start, unsigned long end)
    > + unsigned long start, unsigned long end,
    > + bool nofail)

    This sounds like a very bad idea to me. Your nofail definition might
    differ from what we actually define as __GFP_NOFAIL but I do not think
    this interface should ever promise anything that strong.
    Sure movable, cma regions should effectively never fail but there will
    never be any _guarantee_ for that.

    Earlier in the discussion I have suggested dynamic debugging facility.
    Documentation/admin-guide/dynamic-debug-howto.rst. Have you tried to
    look into that direction?

    > {
    > /* This function is based on compact_zone() from compaction.c. */
    > unsigned int nr_reclaimed;
    > @@ -8522,7 +8523,8 @@ static int __alloc_contig_migrate_range(struct compact_control *cc,
    > NULL, (unsigned long)&mtc, cc->mode, MR_CONTIG_RANGE);
    > }
    > if (ret < 0) {
    > - dump_migrate_failure_pages(&cc->migratepages);
    > + if (ret == -EBUSY && nofail)
    > + dump_migrate_failure_pages(&cc->migratepages);
    > putback_movable_pages(&cc->migratepages);
    > return ret;
    > }
    > @@ -8610,7 +8612,9 @@ int alloc_contig_range(unsigned long start, unsigned long end,
    > * allocated. So, if we fall through be sure to clear ret so that
    > * -EBUSY is not accidentally used or returned to caller.
    > */
    > - ret = __alloc_contig_migrate_range(&cc, start, end);
    > + ret = __alloc_contig_migrate_range(&cc, start, end,
    > + migratetype == CMA ||
    > + zone_idx(cc.zone) == ZONE_MOVABLE);
    > if (ret && ret != -EBUSY)
    > goto done;
    > ret =0;

    --
    Michal Hocko
    SUSE Labs

    \
     
     \ /
      Last update: 2021-03-08 13:50    [W:4.241 / U:0.040 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site