Re: [RFC PATCH 03/14] mm/migrate: Add copy_pages_mthread function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Feb 23, 2017 at 01:20:16PM +0530, Anshuman Khandual wrote:
...
> > 
> >> +
> >> +	cthreads = nr_copythreads;
> >> +	cthreads = min_t(unsigned int, cthreads, cpumask_weight(cpumask));
> > 
> > nitpick, but looks a little wordy, can it be simply like below?
> > 
> >   cthreads = min_t(unsigned int, nr_copythreads, cpumask_weight(cpumask));
> > 
> >> +	cthreads = (cthreads / 2) * 2;
> > 
> > I'm not sure the intention here. # of threads should be even number?
> 
> Yes.
> 
> > If cpumask_weight() is 1, cthreads is 0, that could cause zero division.
> > So you had better making sure to prevent it.
> 
> If cpumask_weight() is 1, then min_t(unsigned int, 8, 1) should be
> greater that equal to 1. Then cthreads can end up in 0. That is
> possible. But how there is a chance of zero division ? 

Hi Anshuman,

I just thought like above when reading the line your patch introduces:

       chunk_size = PAGE_SIZE * nr_pages / cthreads
                                           ~~~~~~~~
                                           (this can be 0?)

- Naoya

> May be its
> possible if we are trying move into a CPU less memory only node
> where cpumask_weight() is 0 ?
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]
  Powered by Linux