linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: <jiang.biao2@zte.com.cn>
To: vbabka@suse.cz
Cc: wen.yang99@zte.com.cn, linux-mm@kvack.org,
	akpm@linux-foundation.org, mhocko@suse.com,
	kirill.shutemov@linux.intel.com, hannes@cmpxchg.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm/vmstat: fix divide error at __fragmentation_index
Date: Thu, 3 Aug 2017 16:46:02 +0800 (CST)	[thread overview]
Message-ID: <201708031646027704154@zte.com.cn> (raw)


[-- Attachment #1.1.1: Type: text/plain, Size: 1213 bytes --]

> > On 08/03/2017 09:59 AM, Wen Yang wrote:



> > From: Jiang Biao <jiang.biao2@zte.com.cn>
> > 
> > When order is -1 or too big, *1UL << order* will be 0, which will
> > cause divide error like this,
> > 
> >     divide error: 0000 [#1] SMP
> >     Call Trace:
>>      [<ffffffff81168423>] compaction_suitable+0x63/0xc0
>> ...
> The trace seems to be from an old and non-mainline kernel, as it's the
> same as you reported here:
> 
> https://bugzilla.kernel.org/show_bug.cgi?id=196555
> 
> In current mainline it seems to me that all callers of
> __fragmentation_index() will only do so with a valid order.
> 
> I wouldn't mind making a non-hotpath code more robust, but probably in a
> more obvious and self-reporting/documented way e.g. something like
> 
> if (WARN_ON_ONCE(order >= MAX_ORDER))
>     return 0
> 
yes, I noticed that, I'll send a new patch for that.




> > @@ -870,6 +870,9 @@ static int __fragmentation_index(unsigned int order, struct contig_page_info *in
> >  {
> >      unsigned long requested = 1UL << order
> >  
> > +        if (!requested)
> > +                return 0
> 
> Seems the indentation is broken here (spaces vs tabs).
I'll fix that.

[-- Attachment #1.1.2: Type: text/html , Size: 2542 bytes --]

             reply	other threads:[~2017-08-03  8:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-03  8:46 jiang.biao2 [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-08-03  9:12 Wen Yang
2017-08-03  7:59 Wen Yang
2017-08-03  8:09 ` Vlastimil Babka

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=201708031646027704154@zte.com.cn \
    --to=jiang.biao2@zte.com.cn \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=vbabka@suse.cz \
    --cc=wen.yang99@zte.com.cn \
    /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