DMA Engine development
 help / color / mirror / Atom feed
* dma: cppi41: delete channel from pending list when stop channel
From: Peter Ujfalusi @ 2018-11-28 11:16 UTC (permalink / raw)
  To: Bin Liu, dmaengine; +Cc: linux-usb, Vinod, stable

Hi,

On 28/11/2018 13.15, Peter Ujfalusi wrote:

forgot to fix up Vinod's email address.

> 
> 
> On 12/11/2018 17.40, Bin Liu wrote:
> 
> Can you fix up the subject line to:
> dmaengine: ti: cppi4: delete channel from pending list when stop channel
> 
>> The driver defines three states for a cppi channel.
>> - idle: .chan_busy == 0 && not in .pending list
>> - pending: .chan_busy == 0 && in .pending list
>> - busy: .chan_busy == 1 && not in .pending list
>>
>> There are cases in which the cppi channel could be in the pending state
>> when cppi41_dma_issue_pending() is called after cppi41_runtime_suspend()
>> is called.
>>
>> cppi41_stop_chan() has a bug for these cases to set channels to idle state.
>> It only checks the .chan_busy flag, but not the .pending list, then later
>> when cppi41_runtime_resume() is called the channels in .pending list will
>> be transitioned to busy state.
>>
>> Removing channels from the .pending list solves the problem.
> 
> So, let me see if I understand this correctly:
> - client issued a transfer _after_ the cppi4 driver is suspended
> - cppi41_dma_issue_pending() will place it to pending list and will not
> start the transfer right away as cdd->is_suspended is true.
> - on resume the cppi4 will pick up the pending transfers from the
> pending list
> 
> This is so far a sane thing to do.
> 
> If I guess right, then after the issue_pending the client driver will
> call terminate_all, presumably from it's suspend callback?
> 
> As per the purpose of terminate_all we should terminated all future
> transfers on the channel, so clearing the pending list is the correct
> thing to do.
> 
> With the fixed subject:
> Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
> 
> I have one question:
> 
>> Fixes: 975faaeb9985 ("dma: cppi41: start tear down only if channel is busy")
>> Cc: stable@vger.kernel.org # v3.15+
>> Signed-off-by: Bin Liu <b-liu@ti.com>
>> ---
>>  drivers/dma/ti/cppi41.c | 16 +++++++++++++++-
>>  1 file changed, 15 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/dma/ti/cppi41.c b/drivers/dma/ti/cppi41.c
>> index 1497da367710..e507ec36c0d3 100644
>> --- a/drivers/dma/ti/cppi41.c
>> +++ b/drivers/dma/ti/cppi41.c
>> @@ -723,8 +723,22 @@ static int cppi41_stop_chan(struct dma_chan *chan)
>>  
>>  	desc_phys = lower_32_bits(c->desc_phys);
>>  	desc_num = (desc_phys - cdd->descs_phys) / sizeof(struct cppi41_desc);
>> -	if (!cdd->chan_busy[desc_num])
>> +	if (!cdd->chan_busy[desc_num]) {
>> +		struct cppi41_channel *cc, *_ct;
>> +
>> +		/*
>> +		 * channels might still be in the pendling list if
>> +		 * cppi41_dma_issue_pending() is called after
>> +		 * cppi41_runtime_suspend() is called
>> +		 */
>> +		list_for_each_entry_safe(cc, _ct, &cdd->pending, node) {
>> +			if (cc != c)
>> +				continue;
>> +			list_del(&cc->node);
> 
> If we delete from the pending list, are we going to leak memory?
> I'm not familiar with the cppi4, it might not be an issue for it.
> 
>> +			break;
>> +		}
>>  		return 0;
>> +	}
>>  
>>  	ret = cppi41_tear_down_chan(c);
>>  	if (ret)
>>
> 
> - Péter
> 
> Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
> Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply

* dma: cppi41: delete channel from pending list when stop channel
From: Peter Ujfalusi @ 2018-11-28 11:15 UTC (permalink / raw)
  To: Bin Liu, dmaengine; +Cc: linux-usb, Vinod Koul, stable

On 12/11/2018 17.40, Bin Liu wrote:

Can you fix up the subject line to:
dmaengine: ti: cppi4: delete channel from pending list when stop channel

> The driver defines three states for a cppi channel.
> - idle: .chan_busy == 0 && not in .pending list
> - pending: .chan_busy == 0 && in .pending list
> - busy: .chan_busy == 1 && not in .pending list
> 
> There are cases in which the cppi channel could be in the pending state
> when cppi41_dma_issue_pending() is called after cppi41_runtime_suspend()
> is called.
> 
> cppi41_stop_chan() has a bug for these cases to set channels to idle state.
> It only checks the .chan_busy flag, but not the .pending list, then later
> when cppi41_runtime_resume() is called the channels in .pending list will
> be transitioned to busy state.
> 
> Removing channels from the .pending list solves the problem.

So, let me see if I understand this correctly:
- client issued a transfer _after_ the cppi4 driver is suspended
- cppi41_dma_issue_pending() will place it to pending list and will not
start the transfer right away as cdd->is_suspended is true.
- on resume the cppi4 will pick up the pending transfers from the
pending list

This is so far a sane thing to do.

If I guess right, then after the issue_pending the client driver will
call terminate_all, presumably from it's suspend callback?

As per the purpose of terminate_all we should terminated all future
transfers on the channel, so clearing the pending list is the correct
thing to do.

With the fixed subject:
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@ti.com>

I have one question:

> Fixes: 975faaeb9985 ("dma: cppi41: start tear down only if channel is busy")
> Cc: stable@vger.kernel.org # v3.15+
> Signed-off-by: Bin Liu <b-liu@ti.com>
> ---
>  drivers/dma/ti/cppi41.c | 16 +++++++++++++++-
>  1 file changed, 15 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/dma/ti/cppi41.c b/drivers/dma/ti/cppi41.c
> index 1497da367710..e507ec36c0d3 100644
> --- a/drivers/dma/ti/cppi41.c
> +++ b/drivers/dma/ti/cppi41.c
> @@ -723,8 +723,22 @@ static int cppi41_stop_chan(struct dma_chan *chan)
>  
>  	desc_phys = lower_32_bits(c->desc_phys);
>  	desc_num = (desc_phys - cdd->descs_phys) / sizeof(struct cppi41_desc);
> -	if (!cdd->chan_busy[desc_num])
> +	if (!cdd->chan_busy[desc_num]) {
> +		struct cppi41_channel *cc, *_ct;
> +
> +		/*
> +		 * channels might still be in the pendling list if
> +		 * cppi41_dma_issue_pending() is called after
> +		 * cppi41_runtime_suspend() is called
> +		 */
> +		list_for_each_entry_safe(cc, _ct, &cdd->pending, node) {
> +			if (cc != c)
> +				continue;
> +			list_del(&cc->node);

If we delete from the pending list, are we going to leak memory?
I'm not familiar with the cppi4, it might not be an issue for it.

> +			break;
> +		}
>  		return 0;
> +	}
>  
>  	ret = cppi41_tear_down_chan(c);
>  	if (ret)
> 

- Péter

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki.
Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply

* dmaengine: at_hdmac: fix module unloading
From: Richard Genoud @ 2018-11-27 16:06 UTC (permalink / raw)
  To: Ludovic Desroches, Dan Williams, Vinod Koul
  Cc: Alexandre Belloni, Nicolas Ferre, Maxime Ripard, Mario Forner,
	linux-arm-kernel, dmaengine, linux-kernel, linux-serial,
	Richard Genoud, stable

of_dma_controller_free() was not called on module onloading.
This lead to a soft lockup:
watchdog: BUG: soft lockup - CPU#0 stuck for 23s!
Modules linked in: at_hdmac [last unloaded: at_hdmac]
when of_dma_request_slave_channel() tried to call ofdma->of_dma_xlate().

Cc: stable@vger.kernel.org
Fixes: bbe89c8e3d59 ("at_hdmac: move to generic DMA binding")
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 drivers/dma/at_hdmac.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 1b7f0ca0d5cd..01d936c9fe89 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -2006,6 +2006,8 @@ static int at_dma_remove(struct platform_device *pdev)
 	struct resource		*io;
 
 	at_dma_off(atdma);
+	if (pdev->dev.of_node)
+		of_dma_controller_free(pdev->dev.of_node);
 	dma_async_device_unregister(&atdma->dma_common);
 
 	dma_pool_destroy(atdma->memset_pool);

^ permalink raw reply related

* dmaengine: at_hdmac: fix memory leak in at_dma_xlate()
From: Richard Genoud @ 2018-11-27 16:06 UTC (permalink / raw)
  To: Ludovic Desroches, Dan Williams, Vinod Koul
  Cc: Alexandre Belloni, Nicolas Ferre, Maxime Ripard, Mario Forner,
	linux-arm-kernel, dmaengine, linux-kernel, linux-serial,
	Richard Genoud, stable

The leak was found when opening/closing a serial port a great number of
time, increasing kmalloc-32 in slabinfo.

Each time the port was opened, dma_request_slave_channel() was called.
Then, in at_dma_xlate(), atslave was allocated with devm_kzalloc() and
never freed. (Well, it was free at module unload, but that's not what we
want).
So, here, kzalloc is more suited for the job since it has to be freed in
atc_free_chan_resources().

Cc: stable@vger.kernel.org
Fixes: bbe89c8e3d59 ("at_hdmac: move to generic DMA binding")
Reported-by: Mario Forner <m.forner@be4energy.com>
Suggested-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Acked-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Signed-off-by: Richard Genoud <richard.genoud@gmail.com>
---
 drivers/dma/at_hdmac.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c
index 7cbac6e8c113..1b7f0ca0d5cd 100644
--- a/drivers/dma/at_hdmac.c
+++ b/drivers/dma/at_hdmac.c
@@ -1641,6 +1641,12 @@ static void atc_free_chan_resources(struct dma_chan *chan)
 	atchan->descs_allocated = 0;
 	atchan->status = 0;
 
+	/*
+	 * Free atslave allocated in at_dma_xlate()
+	 */
+	kfree(chan->private);
+	chan->private = NULL;
+
 	dev_vdbg(chan2dev(chan), "free_chan_resources: done\n");
 }
 
@@ -1675,7 +1681,7 @@ static struct dma_chan *at_dma_xlate(struct of_phandle_args *dma_spec,
 	dma_cap_zero(mask);
 	dma_cap_set(DMA_SLAVE, mask);
 
-	atslave = devm_kzalloc(&dmac_pdev->dev, sizeof(*atslave), GFP_KERNEL);
+	atslave = kzalloc(sizeof(*atslave), GFP_KERNEL);
 	if (!atslave)
 		return NULL;
 

^ permalink raw reply related

* [V2] mm: Replace all open encodings for NUMA_NO_NODE
From: Vinod Koul @ 2018-11-27 13:58 UTC (permalink / raw)
  To: Anshuman Khandual
  Cc: linux-mm, linux-kernel, ocfs2-devel, linux-fbdev, dri-devel,
	netdev, intel-wired-lan, linux-media, iommu, linux-rdma,
	dmaengine, linux-block, sparclinux, linuxppc-dev, linux-ia64,
	linux-alpha, akpm, jiangqi903, hverkuil

On 26-11-18, 17:56, Anshuman Khandual wrote:
> At present there are multiple places where invalid node number is encoded
> as -1. Even though implicitly understood it is always better to have macros
> in there. Replace these open encodings for an invalid node number with the
> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
> 'invalid node' from various places redirecting them to a common definition.
> 

>  drivers/dma/dmaengine.c                       |  4 +++-


Acked-by: Vinod Koul <vkoul@kernel.org>

^ permalink raw reply

* DMA: atmel_serial: Opening and closing the serial device repeatedly causes kmalloc-32 slab leak
From: Richard Genoud @ 2018-11-27 10:46 UTC (permalink / raw)
  To: Alexandre Belloni, richard.genoud
  Cc: Ludovic Desroches, Nicolas Ferre, Maxime Ripard,
	linux-arm-kernel@lists.infradead.org, dmaengine, Linux Kernel,
	linux-serial@vger.kernel.org, Mario Forner, Vinod Koul

Le 27/11/2018 à 10:58, Alexandre Belloni a écrit :
> Hello Richard,
> 
> On 27/11/2018 10:51:13+0100, richard.genoud@gmail.com wrote:
>> Hi all,
>>
>> I reproduced the memory leak on my board (at91sam9g35-cm) with a 4.20-rc3.
>>
>> It triggered an OOM after a couple of hours running a code like this:
>> #include <sys/types.h>
>> #include <sys/stat.h>
>> #include <fcntl.h>
>> #include <unistd.h>
>>
>>
>> int main(int argc, char **argv)
>> {
>> 	int fd;
>> 	do {
>> 		fd = open("/dev/ttyS1", O_RDONLY);
>> 		close(fd);
>> 	} while (true);
>> 	return 0;
>> }
>>
>> As Mario pointed out, this only happens when atmel,use-dma-{r,t}x are
>> used in the device-tree.
>>
>> Adding:
>> CONFIG_DEBUG_SLAB=y
>> CONFIG_DEBUG_SLAB_LEAK=y
>> Doesn't show anything suspect in /proc/slab_allocators
>>
>> From what I found until now, it's something done in :
>> dma_request_slave_channel();
>> that leaks kmalloc-32
>> Mabe I missed something, but it seems that everything DMA related is
>> deallocated in atmel_release_{tx,rx}_dma().
>>
>> Is this ringing a bell ?
>>
> 
> Yes, this is known issue and it has yet to be worked on.
> 

After a talk on freenode, Alex found the problem.
A patch is on its way.

Thanks !

^ permalink raw reply

* DMA: atmel_serial: Opening and closing the serial device repeatedly causes kmalloc-32 slab leak
From: Richard Genoud @ 2018-11-27  9:55 UTC (permalink / raw)
  To: Ludovic Desroches, Nicolas Ferre, Maxime Ripard, Vinod Koul,
	Alexandre Belloni
  Cc: linux-arm-kernel@lists.infradead.org, dmaengine, Linux Kernel,
	linux-serial@vger.kernel.org, Mario Forner

[re-sending with Vinod's correct email address. Sorry for the noise. ]

[re-sending the bug report to the lists]
Le 16/11/2018 à 17:04, Mario Forner a écrit :
> Problem:
> When I open and close the serial device /dev/ttyS4 in a loop
> the amount of kmalloc-32 slabs increases slowly but steadily without limit.
> 
> The serial device is configured in acme-aria.dts to use DMA.
> 
> If DMA is disabled, the amount of kmalloc32-slabs remains constant
> over several hours, just fluctuating slightly.
> 
> The serial device is accessed by atmel_serial.c which is evident from
> the drivers kernel log output.
> 
> The bug was noticed on a device which had been running over several weeks and
> has accumulated ~86MB of unrelaimable kmalloc-32 slabs by now. Example:
> 
> root@master1083:~# slabtop -o | head -10
>  Active / Total Objects (% used)    : 2704880 / 2716124 (99.6%)
>  Active / Total Slabs (% used)      : 23150 / 23150 (100.0%)
>  Active / Total Caches (% used)     : 57 / 76 (75.0%)
>  Active / Total Size (% used)       : 88893.62K / 89964.32K (98.8%)
>  Minimum / Average / Maximum Object : 0.02K / 0.03K / 4096.00K
> 
>   OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
> 2674804 2673840  99%    0.03K  21571      124     86284K kmalloc-32
>   7200   7104  98%    0.08K    144       50       576K kernfs_node_cache
>   6930   5370  77%    0.13K    231       30       924K dentry     
> 
> root@master1083:~# uptime
>  15:12:55 up 93 days, 16:54,  1 user,  load average: 1.59, 2.31, 2.42 
> 
> Keywords:  atmel, serial, kernel, leak, memory, dma, slab, kmalloc
> 
> Kernel information:
> 
> Kernel version:
> Linux version 4.2.6 (mario@linux-7rm0) (gcc version 4.9.3 (crosstool-NG ) ) #115 Fri Nov 16 11:05:22 CET 2018
> Linux version 4.9.124 (mario@linux-7rm0) (gcc version 4.9.3 (crosstool-NG ) ) #16 Fri Nov 16 13:54:25 CET 2018   
> 
> Most recent Kernel version which did not have the bug:  unknown         
> 
> How to reproduce the bug:
> 
> The kmalloc-32 slab count should be monitored every few minutes with "slabtop -o".
> The leak can be triggered by running the following script, given DMA has
> been enabled for ttyS4:
> 
> #!/usr/bin/env python
> import serial
> import time
> 
> while True:
>     try:
>         with serial.Serial(port = '/dev/ttyS4'):
>             pass
>     except Exception as e:
>         print e
>     finally:
>         time.sleep(0.5)
> # end script
> 
> Environment:
> Software:
> Linux master 4.2.6 #114 Fri Nov 16 10:14:30 CET 2018 armv5tejl GNU/Linux
> 
> Binutils                2.25
> Util-linux              2.25.2
> Mount                   2.25.2
> Module-init-tools       18
> E2fsprogs               1.42.12
> Linux C Library         2.19
> Dynamic linker (ldd)    2.19
> Linux C++ Library       6.0.20
> Procps                  3.3.9
> Net-tools               1.60
> Sh-utils                8.23
> Udev                    215
> Modules Loaded          iptable_nat option usb_wwan usbserial  
> 
> Processor information:
> # cat /proc/cpuinfo
> processor       : 0
> model name      : ARM926EJ-S rev 5 (v5l)
> BogoMIPS        : 198.76
> Features        : swp half thumb fastmult edsp java
> CPU implementer : 0x41
> CPU architecture: 5TEJ
> CPU variant     : 0x0
> CPU part        : 0x926
> CPU revision    : 5
> 
> Hardware        : Atmel AT91SAM9
> Revision        : 0000
> Serial          : 0000000000000000  
> 
> Module information:
> # cat /proc/modules
> iptable_nat 1720 0 - Live 0xbf0a5000
> option 28780 0 - Live 0xbf03c000
> usb_wwan 6876 1 option, Live 0xbf024000
> usbserial 23392 2 option,usb_wwan, Live 0xbf000000
> 
> Loaded drivers:
> # cat /proc/ioports
> # cat /proc/iomem
> 00300000-00307fff : 300000.sram
> 00600000-006fffff : /ahb/ohci@00600000
> 00700000-007fffff : /ahb/ehci@00700000
> 20000000-2fffffff : System RAM
>   20008000-20577287 : Kernel code
>   205a8000-205f02b7 : Kernel data
> f0000000-f00000ff : /ahb/apb/spi@f0000000
> f8008000-f80080ff : /ahb/apb/timer@f8008000
> f800c000-f800c0ff : /ahb/apb/timer@f800c000
> f8010000-f80100ff : /ahb/apb/i2c@f8010000
> f8014000-f80140ff : /ahb/apb/i2c@f8014000
> f801c000-f801c1ff : atmel_serial
> f8020000-f80201ff : atmel_serial
> f8024000-f80241ff : atmel_serial
> f8028000-f80281ff : atmel_serial
> f802c000-f802c0ff : /ahb/apb/ethernet@f802c000
> f8034000-f80342ff : /ahb/apb/pwm@f8034000
> f804c000-f804c0ff : /ahb/apb/adc@f804c000
> ffffec00-ffffedff : at_hdmac
> ffffee00-ffffefff : at_hdmac
> fffff200-fffff3ff : atmel_serial
> fffff400-fffff5ff : /ahb/apb/pinctrl@fffff400/gpio@fffff400
> fffff600-fffff7ff : /ahb/apb/pinctrl@fffff400/gpio@fffff600
> fffff800-fffff9ff : /ahb/apb/pinctrl@fffff400/gpio@fffff800
> fffffa00-fffffbff : /ahb/apb/pinctrl@fffff400/gpio@fffffa00
> fffffe10-fffffe1f : /ahb/apb/shdwc@fffffe10
> 
> Other Information:
> The serial device ttyS4 is configuered inside .dts file by
> 
> usart3: serial@f8028000 {
>     status = "okay";
>     compatible = "atmel,at91sam9260-usart";
>     reg = <0xf8028000 0x200>;
>     interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>;
>     pinctrl-names = "default";
>     atmel,use-dma-tx;
>     atmel,use-dma-rx;
>     pinctrl-0 = <&pinctrl_usart3
>     &pinctrl_usart3_rts~
>     &pinctrl_usart3_cts>;
>     linux,rs485-enabled-at-boot-time;
>     rs485-rts-delay = <0 0>;
> };
> 
> Other notes:
> I tried the SLUB allocator with slub_debug=U but opening serial device then
> resulted in a Kernel-Oops:
>     at BUGON(ents < 0);
>     in function: dma_map_sg_attrs
>     in file: /include/asm-generic/dma-mapping-common.h
> So I could not gather information that way. I don't know if this is related.
> SLUB works if User Tracking is disabled.
> 
> Enabling kmemleak did not detect any leaks.
> 
> I also tried kernel version 4.19.1 and it exhibits the same behaviour, but I
> could not configure it to run reliably on the target system yet. 
> 

Hi all,

I reproduced the memory leak on my board (at91sam9g35-cm) with a 4.20-rc3.

It triggered an OOM after a couple of hours running a code like this:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>


int main(int argc, char **argv)
{
	int fd;
	do {
		fd = open("/dev/ttyS1", O_RDONLY);
		close(fd);
	} while (true);
	return 0;
}

As Mario pointed out, this only happens when atmel,use-dma-{r,t}x are
used in the device-tree.

Adding:
CONFIG_DEBUG_SLAB=y
CONFIG_DEBUG_SLAB_LEAK=y
Doesn't show anything suspect in /proc/slab_allocators

From what I found until now, it's something done in :
dma_request_slave_channel();
that leaks kmalloc-32
Mabe I missed something, but it seems that everything DMA related is
deallocated in atmel_release_{tx,rx}_dma().

Is this ringing a bell ?



The oom-killer, slabinfo, meminfo and slab_allocator traces follow.

NB: the -dirty flag is there beacause I removed some log from atmel-serial:
 	atmel_port->chan_rx = dma_request_slave_channel(mfd_dev, "rx");
 	if (atmel_port->chan_rx == NULL)
 		goto chan_err;
-	dev_info(port->dev, "using %s for rx DMA transfers\n",
-		dma_chan_name(atmel_port->chan_rx));
  	spin_lock_init(&atmel_port->lock_rx);
 	sg_init_table(&atmel_port->sg_rx, 1);



OOM-killer trace :
[ 5220.560000] test_open invoked oom-killer: gfp_mask=0x6200ca(GFP_HIGHUSER_MOVABLE), nodemask=(null), order=0, oom_score_adj=0
[ 5220.580000] CPU: 0 PID: 1062 Comm: test_open Not tainted 4.20.0-rc3-dirty #31
[ 5220.580000] Hardware name: Atmel AT91SAM9
[ 5220.590000] Backtrace: [ 5220.590000] [<c000e020>] (dump_backtrace) from [<c000e2b8>] (show_stack+0x20/0x24)
[ 5220.600000]  r6:00000009 r5:c0649bb5 r4:c72a1e18 r3:02b88502
[ 5220.600000] [<c000e298>] (show_stack) from [<c0521114>] (dump_stack+0x20/0x28)
[ 5220.610000] [<c05210f4>] (dump_stack) from [<c0097280>] (dump_header+0x6c/0x1c4)
[ 5220.620000] [<c0097214>] (dump_header) from [<c0096454>] (oom_kill_process+0x6c/0x3cc)
[ 5220.620000]  r10:00000001 r8:c070e788 r7:c72a1e18 r6:00000009 r5:c0649bb5 r4:c7b64ea0
[ 5220.630000] [<c00963e8>] (oom_kill_process) from [<c009712c>] (out_of_memory+0x388/0x41c)
[ 5220.640000]  r10:00000001 r9:00000000 r8:c070e788 r7:0000000b r6:c070e8e4 r5:c070e788
[ 5220.650000]  r4:c72a1e18
[ 5220.650000] [<c0096da4>] (out_of_memory) from [<c009b1d8>] (__alloc_pages_nodemask+0x8b4/0xc48)
[ 5220.660000]  r8:00000011 r7:00000000 r6:00000000 r5:00000000 r4:006200ca
[ 5220.670000] [<c009a924>] (__alloc_pages_nodemask) from [<c0092bd4>] (filemap_fault+0x384/0x54c)
[ 5220.680000]  r10:c609b480 r9:00000000 r8:00000004 r7:00000000 r6:c72a1ed0 r5:c77dbb5c
[ 5220.680000]  r4:006200ca
[ 5220.690000] [<c0092850>] (filemap_fault) from [<c00babe8>] (__do_fault+0x28/0x9c)
[ 5220.690000]  r10:c7375a20 r9:c7375a58 r8:80000005 r7:000000b1 r6:b6efe000 r5:c72a1ed0
[ 5220.700000]  r4:00000000
[ 5220.700000] [<c00babc0>] (__do_fault) from [<c00bd9b0>] (handle_mm_fault+0x3e4/0x97c)
[ 5220.710000]  r5:000000c0 r4:00000000
[ 5220.720000] [<c00bd5cc>] (handle_mm_fault) from [<c000f774>] (do_page_fault+0x138/0x2ac)
[ 5220.720000]  r7:00000054 r6:b6efef9c r5:c72a1fb0 r4:c7a300e0
[ 5220.730000] [<c000f63c>] (do_page_fault) from [<c000f99c>] (do_translation_fault+0x2c/0xb4)
[ 5220.740000]  r10:b6f9e000 r9:00000000 r8:00053177 r7:80000005 r6:b6efef9c r5:c070f91c
[ 5220.750000]  r4:00000005
[ 5220.750000] [<c000f970>] (do_translation_fault) from [<c000fb38>] (do_PrefetchAbort+0x44/0x94)
[ 5220.760000]  r7:c72a1fb0 r6:b6efef9c r5:c070f91c r4:00000005
[ 5220.760000] [<c000faf4>] (do_PrefetchAbort) from [<c0009f08>] (ret_from_exception+0x0/0x18)
[ 5220.770000] Exception stack(0xc72a1fb0 to 0xc72a1ff8)
[ 5220.780000] 1fa0:                                     00000000 00000000 beb25d54 beb25e71
[ 5220.780000] 1fc0: 00000000 00000000 000082f4 00000006 00000000 00000000 b6f9e000 beb25bf4
[ 5220.790000] 1fe0: 00000000 beb25bdc 0000847c b6efef9c 40000010 ffffffff
[ 5220.800000]  r7:0005317f r6:ffffffff r5:40000010 r4:b6efef9c
[ 5220.800000] Mem-Info:
[ 5220.810000] active_anon:1659 inactive_anon:47 isolated_anon:0
[ 5220.810000]  active_file:2 inactive_file:4 isolated_file:0
[ 5220.810000]  unevictable:0 dirty:0 writeback:0 unstable:0
[ 5220.810000]  slab_reclaimable:1098 slab_unreclaimable:26200
[ 5220.810000]  mapped:3 shmem:60 pagetables:125 bounce:0
[ 5220.810000]  free:344 free_pcp:45 free_cma:0
[ 5220.840000] Node 0 active_anon:6636kB inactive_anon:188kB active_file:8kB inactive_file:16kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:12kB dirty:0kB writeback:0kB shmem:240kB writeback_tmp:0kB unstable:0kB all_unreclaimable? yes
[ 5220.860000] Normal free:1376kB min:1396kB low:1744kB high:2092kB active_anon:6636kB inactive_anon:188kB active_file:8kB inactive_file:16kB unevictable:0kB writepending:0kB present:131072kB managed:122316kB mlocked:0kB kernel_stack:448kB pagetables:500kB bounce:0kB free_pcp:180kB local_pcp:180kB free_cma:0kB
[ 5220.890000] lowmem_reserve[]: 0 0
[ 5220.890000] Normal: 0*4kB 54*8kB (U) 29*16kB (U) 11*32kB (U) 2*64kB (U) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 1376kB
[ 5220.900000] 66 total pagecache pages
[ 5220.910000] 32768 pages RAM
[ 5220.910000] 0 pages HighMem/MovableOnly
[ 5220.910000] 2189 pages reserved
[ 5220.920000] Unreclaimable slab info:
[ 5220.920000] Name                      Used          Total
[ 5220.930000] ubi_wl_entry_slab         92KB         93KB
[ 5220.930000] bridge_fdb_cache           0KB          3KB
[ 5220.940000] fib6_nodes                 0KB          3KB
[ 5220.940000] ip6_dst_cache              0KB          3KB
[ 5220.950000] RAWv6                      4KB          7KB
[ 5220.950000] UDPv6                      1KB          7KB
[ 5220.960000] TCPv6                      3KB          6KB
[ 5220.960000] sd_ext_cdb                 0KB          3KB
[ 5220.970000] sgpool-128                 4KB          4KB
[ 5220.970000] sgpool-64                  2KB          4KB
[ 5220.980000] sgpool-32                  1KB          4KB
[ 5220.980000] sgpool-16                  0KB          4KB
[ 5220.990000] sgpool-8                   0KB          4KB
[ 5220.990000] nfs_commit_data            1KB          3KB
[ 5221.000000] nfs_write_data            18KB         19KB
[ 5221.000000] bio-1                      0KB          3KB
[ 5221.010000] rpc_buffers               16KB         16KB
[ 5221.010000] rpc_tasks                  1KB          4KB
[ 5221.020000] UNIX                      14KB         15KB
[ 5221.030000] tcp_bind_bucket            0KB          3KB
[ 5221.030000] ip_fib_trie                0KB          3KB
[ 5221.040000] ip_fib_alias               0KB          3KB
[ 5221.040000] ip_dst_cache               1KB          4KB
[ 5221.050000] RAW                        1KB          3KB
[ 5221.050000] UDP                        2KB          7KB
[ 5221.060000] TCP                        6KB          6KB
[ 5221.060000] eventpoll_pwq              0KB          3KB
[ 5221.070000] eventpoll_epi              1KB          3KB
[ 5221.070000] inotify_inode_mark          1KB          3KB
[ 5221.080000] request_queue             18KB         22KB
[ 5221.080000] blkdev_ioc                 0KB          3KB
[ 5221.090000] bio-0                      4KB          7KB
[ 5221.090000] biovec-max                90KB         90KB
[ 5221.100000] uid_cache                  0KB          3KB
[ 5221.100000] dmaengine-unmap-2          0KB          3KB
[ 5221.110000] skbuff_head_cache          5KB          7KB
[ 5221.110000] configfs_dir_cache          0KB          3KB
[ 5221.120000] file_lock_ctx              0KB          3KB
[ 5221.130000] fsnotify_mark_connector          0KB          3KB
[ 5221.130000] shmem_inode_cache        205KB        210KB
[ 5221.140000] proc_dir_entry            30KB         30KB
[ 5221.140000] pde_opener                 0KB          3KB
[ 5221.150000] seq_file                   0KB          3KB
[ 5221.150000] kernfs_node_cache        672KB        673KB
[ 5221.160000] mnt_cache                  5KB          7KB
[ 5221.160000] filp                      52KB         58KB
[ 5221.170000] names_cache               24KB         24KB
[ 5221.170000] key_jar                    0KB          4KB
[ 5221.180000] nsproxy                    0KB          3KB
[ 5221.180000] vm_area_struct            92KB        103KB
[ 5221.190000] mm_struct                 12KB         14KB
[ 5221.190000] fs_cache                   0KB          3KB
[ 5221.200000] files_cache                5KB         11KB
[ 5221.200000] signal_cache              33KB         46KB
[ 5221.210000] sighand_cache             71KB         80KB
[ 5221.210000] task_struct               57KB         86KB
[ 5221.220000] cred_jar                  13KB         20KB
[ 5221.220000] anon_vma_chain            32KB         46KB
[ 5221.230000] anon_vma                  29KB         39KB
[ 5221.240000] pid                        4KB          7KB
[ 5221.240000] debug_objects_cache         48KB         50KB
[ 5221.250000] trace_event_file          85KB         86KB
[ 5221.250000] ftrace_event_field        161KB        163KB
[ 5221.260000] pool_workqueue             1KB          4KB
[ 5221.260000] kmalloc-256k             256KB        256KB
[ 5221.270000] kmalloc-64k               64KB         64KB
[ 5221.270000] kmalloc-32k               32KB         32KB
[ 5221.280000] kmalloc-16k               32KB         32KB
[ 5221.280000] kmalloc-8k               128KB        128KB
[ 5221.290000] kmalloc-4k               104KB        104KB
[ 5221.290000] kmalloc-2k               102KB        108KB
[ 5221.300000] kmalloc-1k               191KB        192KB
[ 5221.300000] kmalloc-512              154KB        168KB
[ 5221.310000] kmalloc-256               64KB         80KB
[ 5221.310000] kmalloc-192               78KB         78KB
[ 5221.320000] kmalloc-128               22KB         24KB
[ 5221.320000] kmalloc-96                60KB         98KB
[ 5221.330000] kmalloc-32             97766KB      97770KB
[ 5221.340000] kmalloc-64               173KB        176KB
[ 5221.340000] kmem_cache                31KB         35KB
[ 5221.350000] Tasks state (memory values in pages):
[ 5221.350000] [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
[ 5221.360000] [    617]     0   617      458       30     8192        0             0 bootlogd
[ 5221.370000] [    653]     0   653      776       11     8192        0             0 syslogd
[ 5221.380000] [    656]     0   656      776       12     6144        0             0 klogd
[ 5221.380000] [    676]     0   676     1578      299    10240        0             0 conf-manager
[ 5221.390000] [    679]     0   679      484       27     6144        0             0 conf-dispatcher
[ 5221.400000] [    688]     0   688      432       17     8192        0             0 keypad
[ 5221.410000] [    700]     0   700      904       79     8192        0         -1000 udevd
[ 5221.420000] [    717]    81   717     1074       49     8192        0             0 dbus-daemon
[ 5221.430000] [    747]     0   747      776       11     8192        0             0 respawn.sh
[ 5221.440000] [    749]     0   749     1493       69    10240        0             0 connmand
[ 5221.440000] [    751]    99   751      581       27     6144        0             0 dnsmasq
[ 5221.450000] [    755]     0   755      572       21     6144        0             0 dropbear
[ 5221.460000] [    759]     0   759     1083       75    10240        0             0 lighttpd
[ 5221.470000] [    761]     0   761     4393      291    20480        0             0 php-cgi
[ 5221.480000] [    763]     0   763     4393      291    22528        0             0 php-cgi
[ 5221.490000] [    768]     0   768      777       39     6144        0             0 lns_networking.
[ 5221.500000] [    839]     0   839      455       23     6144        0             0 inotifywait
[ 5221.500000] [    897]     0   897      776        9     6144        0             0 ntpd
[ 5221.510000] [    905]     0   905     1404       22     8192        0             0 crond
[ 5221.520000] [    922]     0   922      484       21     8192        0             0 event-monitor
[ 5221.530000] [    941]     0   941     1011       29     8192        0             0 sh
[ 5221.540000] [   1062]     0  1062      383       11     6144        0             0 test_open
[ 5221.550000] [   1063]     0  1063      592       31     8192        0             0 dropbear
[ 5221.550000] [   1064]     0  1064     1011       30     8192        0             0 sh
[ 5221.560000] [   5315]     0  5315      776       15     6144        0             0 check_online.sh
[ 5221.570000] [   5316]     0  5316      776       15     4096        0             0 check_online.sh
[ 5221.580000] [   5317]     0  5317     1159       53    10240        0             0 socat
[ 5221.590000] [   5318]     0  5318     1016       37    10240        0             0 xsltproc
[ 5221.600000] [   5319]     0  5319      777        9     8192        0             0 uniq
[ 5221.610000] Out of memory: Kill process 676 (conf-manager) score 9 or sacrifice child
[ 5221.610000] Killed process 676 (conf-manager) total-vm:6312kB, anon-rss:1196kB, file-rss:0kB, shmem-rss:0kB


full stabinfo:
slabinfo - version: 2.1 (statistics)
# name            <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_slabs> <sharedavail> : globalstat <listallocs> <maxobjs> <grown> <reaped> <error> <maxfreeable> <nodeallocs> <remotefrees> <alienoverflow> : cpustat <allochit> <allocmiss> <freehit> <freemiss>
ubi_wl_entry_slab   1964   1992     48   83    1 : tunables   32   16    0 : slabdata     24     24      0 : globalstat    1973   1973    24    0    0    0    0    0    0 : cpustat   1822    142      0      0
ubifs_inode_slab      66    189    432    9    1 : tunables   32   16    0 : slabdata     21     21      0 : globalstat   92965    477    53    0    0    0    0    0    0 : cpustat 354826   5836 355569   5041
bridge_fdb_cache       2     63     64   63    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      48     17     1    0    0    0    0    0    0 : cpustat      1      3      2      0
nf-frags               0      0    152   26    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
xfrm6_tunnel_spi       0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ip6-frags              0      0    152   26    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
fib6_nodes             6     63     64   63    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      32     17     1    0    0    0    0    0    0 : cpustat      4      2      0      0
ip6_dst_cache          3     25    160   25    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat     640     19     1    0    0    0    0    0    0 : cpustat     32     40     69      0
PINGv6                 0      0    832    9    2 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
RAWv6                  5      9    832    9    2 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      13      9     1    0    0    0    0    0    0 : cpustat      4      2      1      0
UDPLITEv6              0      0    832    9    2 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
UDPv6                  1      9    832    9    2 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      17      9     1    0    0    0    0    0    0 : cpustat      4      2      5      0
tw_sock_TCPv6          0      0    200   20    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
request_sock_TCPv6      0      0    256   16    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
TCPv6                  1      4   1760    4    2 : tunables   24   12    0 : slabdata      1      1      0 : globalstat       4      4     1    0    0    0    0    0    0 : cpustat      1      1      1      0
nf_conntrack_expect      0      0    152   26    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
nf_conntrack           0      0    192   21    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
sd_ext_cdb             2     71     56   71    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      1      1      0      0
sgpool-128             2      2   2048    2    1 : tunables   24   12    0 : slabdata      1      1      0 : globalstat       2      2     1    0    0    0    0    0    0 : cpustat      1      1      0      0
sgpool-64              2      4   1024    4    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat       4      4     1    0    0    0    0    0    0 : cpustat      1      1      0      0
sgpool-32              2      8    512    8    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat       8      8     1    0    0    0    0    0    0 : cpustat      1      1      0      0
sgpool-16              2     16    256   16    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      1      1      0      0
sgpool-8               2     32    128   32    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      1      1      0      0
nfs_direct_cache       0      0    208   19    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
nfs_commit_data        4      9    448    9    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat       9      9     1    0    0    0    0    0    0 : cpustat      3      1      0      0
nfs_write_data        32     35    576    7    1 : tunables   32   16    0 : slabdata      5      5      0 : globalstat      35     35     5    0    0    0    0    0    0 : cpustat     27      5      0      0
nfs_read_data          0      0    576    7    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
nfs_inode_cache        0      0    608    6    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
nfs_page               0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
fat_inode_cache        0      0    424    9    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
fat_cache              0      0     48   83    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
jbd2_transaction_s      0      0    160   25    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
jbd2_inode             0      0     48   83    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
jbd2_journal_handle      0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
jbd2_journal_head      0      0     88   46    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
jbd2_revoke_table_s      0      0     40   99    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
jbd2_revoke_record_s      0      0     32  124    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_inode_cache       0      0    624    6    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_free_data         0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_allocation_context      0      0    128   32    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_prealloc_space      0      0     88   46    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_system_zone       0      0     56   71    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_io_end            0      0     72   56    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_pending_reservation      0      0     40   99    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_extent_status      0      0     56   71    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
mbcache                0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kioctx                 0      0    224   18    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
aio_kiocb              0      0     96   42    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
fanotify_event_info      0      0     56   71    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
fsnotify_mark          0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
dnotify_mark           0      0     72   56    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
dnotify_struct         0      0     48   83    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
dio                    0      0    360   11    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
bio-1                  4     25    160   25    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      3      1      0      0
fasync_cache           0      0     48   83    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
posix_timers_cache      0      0    192   21    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
rpc_inode_cache        0      0    352   11    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
rpc_buffers            8      8   2048    2    1 : tunables   24   12    0 : slabdata      4      4      0 : globalstat       8      8     4    0    0    0    0    0    0 : cpustat      4      4      0      0
rpc_tasks              8     32    128   32    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      7      1      0      0
UNIX                   7     28    576    7    1 : tunables   32   16    0 : slabdata      4      4      0 : globalstat   65532     35    88   84    0    0    0    0    0 : cpustat  20071   4224  24288      0
ip4-frags              0      0    160   25    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
UDP-Lite               0      0    704   11    2 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
tcp_bind_bucket        1     63     64   63    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      4      1      4      0
inet_peer_cache        0      0    128   32    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
secpath_cache          0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
xfrm_dst_cache         0      0    224   18    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
xfrm_state             0      0    576    7    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ip_fib_trie           12     71     56   71    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      32     19     1    0    0    0    0    0    0 : cpustat     11      2      1      0
ip_fib_alias          15     71     56   71    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      32     20     1    0    0    0    0    0    0 : cpustat     14      2      1      0
ip_dst_cache          10     32    128   32    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat    1824     24     1    0    0    0    0    0    0 : cpustat    116    114    222      0
PING                   0      0    672    6    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
RAW                    2      6    672    6    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      10      6     1    0    0    0    0    0    0 : cpustat     12      2     12      0
UDP                    0      0    704   11    2 : tunables   32   16    0 : slabdata      0      0      0 : globalstat     994     11     2    2    0    0    0    0    0 : cpustat    580    123    703      0
tw_sock_TCP            0      0    200   20    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
request_sock_TCP       0      0    256   16    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat      16     16     1    1    0    0    0    0    0 : cpustat      0      1      1      0
TCP                    1      4   1664    4    2 : tunables   24   12    0 : slabdata      1      1      0 : globalstat       5      4     1    0    0    0    0    0    0 : cpustat     11      2     12      0
eventpoll_pwq          5     63     64   63    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat    1392     48     1    0    0    0    0    0    0 : cpustat     61     87    142      1
eventpoll_epi          5     42     96   42    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat    1386     42     1    0    0    0    0    0    0 : cpustat     61     87    143      0
inotify_inode_mark     15     56     72   56    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      48     39     1    0    0    0    0    0    0 : cpustat     21      3      9      0
scsi_data_buffer       0      0     48   83    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
request_queue         12     15   1536    5    2 : tunables   24   12    0 : slabdata      3      3      0 : globalstat      15     15     3    0    0    0    0    0    0 : cpustat      9      3      0      0
blkdev_requests        0      0    216   18    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
blkdev_ioc             1     51     80   51    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      0      1      0      0
bio-0                 26     50    160   25    1 : tunables   32   16    0 : slabdata      2      2      0 : globalstat      41     41     2    0    0    0    0    0    0 : cpustat     27      3      4      0
biovec-max            30     30   3072    2    2 : tunables   24   12    0 : slabdata     15     15      0 : globalstat      30     30    15    0    0    0    0    0    0 : cpustat     15     15      0      0
biovec-128             0      0   1536    5    2 : tunables   24   12    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
biovec-64              0      0    768    5    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
biovec-16              0      0    192   21    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
uid_cache              0      0     96   42    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat      16     16     1    1    0    0    0    0    0 : cpustat      1      1      2      0
dmaengine-unmap-2      1    124     32  124    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      0      1      0      0
sock_inode_cache      26     66    352   11    1 : tunables   32   16    0 : slabdata      6      6      0 : globalstat   55763     77     7    0    0    0    0    0    0 : cpustat   7743   3489  11206      0
skbuff_fclone_cache      0      0    384   10    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat    5630     10   552  552    0    0    0    0    0 : cpustat    122    563    685      0
skbuff_head_cache     12     42    192   21    1 : tunables   32   16    0 : slabdata      2      2      0 : globalstat   56541    121     6    1    0    0    0    0    0 : cpustat  24027   3924  27932      9
configfs_dir_cache      1     51     80   51    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      0      1      0      0
file_lock_cache        0      0    144   28    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat    1696     18   103  103    0    0    0    0    0 : cpustat   1338    106   1444      0
file_lock_ctx          1     83     48   83    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      0      1      0      0
fsnotify_mark_connector     15     99     40   99    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      32     32     1    0    0    0    0    0    0 : cpustat     20      2      7      0
shmem_inode_cache    545    560    384   10    1 : tunables   32   16    0 : slabdata     56     56      0 : globalstat     573    560    56    0    0    0    0    0    0 : cpustat    533     58     46      0
proc_dir_entry       203    208    152   26    1 : tunables   32   16    0 : slabdata      8      8      0 : globalstat     232    208     8    0    0    0    0    0    0 : cpustat 1655734     19 1655550      0
pde_opener            16     83     48   83    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat    3392     16   208  207    0    0    0    0    0 : cpustat    379    212    590      0
proc_inode_cache      19     20    384   10    1 : tunables   32   16    0 : slabdata      2      2      0 : globalstat   65673    330    58   24    0    2    0    0    0 : cpustat  17629   9256  26850     29
seq_file              16     39    104   39    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat    3440     19     4    3    0    0    0    0    0 : cpustat   1822    215   2036      0
sigqueue               0      0     72   56    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat     496     25    28   28    0    0    0    0    0 : cpustat     22     31     53      0
bdev_cache            13     18    448    9    1 : tunables   32   16    0 : slabdata      2      2      0 : globalstat      26     18     2    0    0    0    0    0    0 : cpustat     14      3      4      0
kernfs_node_cache   6152   6156    112   36    1 : tunables   32   16    0 : slabdata    171    171      0 : globalstat    6164   6152   171    0    0    0    0    0    0 : cpustat   6046    512    406      0
mnt_cache             23     36    224   18    1 : tunables   32   16    0 : slabdata      2      2      0 : globalstat      34     34     2    0    0    0    0    0    0 : cpustat     20      3      0      0
filp                  94    325    160   25    1 : tunables   32   16    0 : slabdata     13     13      0 : globalstat   56563    366    16    1    0    1    0    0    0 : cpustat 2140672   3542 2141060   3073
inode_cache         7258   7260    344   11    1 : tunables   32   16    0 : slabdata    660    660      0 : globalstat    9668   8316   828   77    0    0    0    0    0 : cpustat   9994    928   3600     64
dentry              7885   8800    160   25    1 : tunables   32   16    0 : slabdata    352    352      0 : globalstat  209061   9941   398    0    0    1    0    0    0 : cpustat 579132  13240 572829  11669
names_cache            1      1   4096    1    1 : tunables   24   12    0 : slabdata      1      1      0 : globalstat    1216     11   965  964    0    0    0    0    0 : cpustat 2313916   1211 2315127      0
key_jar                3     32    128   32    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      2      1      0      0
buffer_head            0      0     88   46    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat      16     16     1    1    0    0    0    0    0 : cpustat      3      1      4      0
nsproxy                1     71     56   71    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      0      1      0      0
vm_area_struct       196    646    120   34    1 : tunables   32   16    0 : slabdata     19     19      0 : globalstat  493665   1326    41    1    0    1    0    0    0 : cpustat 1030662  30889 1031088  30293
mm_struct             25     36    416    9    1 : tunables   32   16    0 : slabdata      4      4      0 : globalstat   19979     45     5    1    0    0    0    0    0 : cpustat  44416   1297  45703      0
fs_cache              18    124     32  124    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat    1904    112     1    0    0    0    0    0    0 : cpustat  23929    119  24029      9
files_cache           18     63    192   21    1 : tunables   32   16    0 : slabdata      3      3      0 : globalstat    1913    105     5    0    0    0    0    0    0 : cpustat  23925    123  24028     10
signal_cache          45     72    608    6    1 : tunables   32   16    0 : slabdata     12     12      0 : globalstat   15230    120    20    1    0    0    0    0    0 : cpustat  23152    965  24070     10
sighand_cache         43     57   1312    3    1 : tunables   24   12    0 : slabdata     19     19      0 : globalstat    1401    117    48    8    0    6    0    0    0 : cpustat  23947    170  24066     14
task_struct           43     84   1056    7    2 : tunables   24   12    0 : slabdata     12     12      0 : globalstat   11531    119    18    0    0    1    0    0    0 : cpustat  23150    969  24064     18
cred_jar              70    160    128   32    1 : tunables   32   16    0 : slabdata      5      5      0 : globalstat   20529    144     5    0    0    0    0    0    0 : cpustat  56391   1284  57604     15
anon_vma_chain       161    781     56   71    1 : tunables   32   16    0 : slabdata     11     11      0 : globalstat  139671   1381    21    1    0    1    0    0    0 : cpustat 472282   8741 473000   7891
anon_vma             125    567     64   63    1 : tunables   32   16    0 : slabdata      9      9      0 : globalstat   68139    741    12    0    0    0    0    0    0 : cpustat 329676   4260 330198   3626
pid                   50    126     64   63    1 : tunables   32   16    0 : slabdata      2      2      0 : globalstat   15054    126     2    0    0    0    0    0    0 : cpustat  23178    941  24066     11
debug_objects_cache   1024   1079     48   83    1 : tunables   32   16    0 : slabdata     13     13      0 : globalstat    1028   1028    13    0    0    0    0    0    0 : cpustat    950     74      0      0
trace_event_file    1219   1232     72   56    1 : tunables   32   16    0 : slabdata     22     22      0 : globalstat    1219   1219    22    0    0    0    0    0    0 : cpustat      0   1219      0      0
ftrace_event_field   2953   2982     56   71    1 : tunables   32   16    0 : slabdata     42     42      0 : globalstat    2959   2959    42    0    0    0    0    0    0 : cpustat   2745    208      0      0
pool_workqueue         4     16    256   16    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      2      2      0      0
radix_tree_node      193    300    328   12    1 : tunables   32   16    0 : slabdata     25     25      0 : globalstat   60882    396    33    0    0    0    0    0    0 : cpustat 234553   3841 234990   3211
kmalloc-rcl-4M         0      0 4194304    1 1024 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-2M         0      0 2097152    1  512 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-1M         0      0 1048576    1  256 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-512k       0      0 524288    1  128 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-256k       0      0 262144    1   64 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-128k       0      0 131072    1   32 : tunables    8    4    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-64k        0      0  65536    1   16 : tunables    8    4    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-32k        0      0  32768    1    8 : tunables    8    4    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-16k        0      0  16384    1    4 : tunables    8    4    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-8k         0      0   8192    1    2 : tunables    8    4    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-4k         0      0   4096    1    1 : tunables   24   12    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-2k         0      0   2048    2    1 : tunables   24   12    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-1k         0      0   1024    4    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-512        0      0    512    8    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-256        0      0    256   16    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-192        0      0    192   21    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-128        0      0    128   32    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-96         0      0     96   42    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-64         1     64     64   64    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      0      1      0      0
kmalloc-rcl-32         0      0     32  124    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-4M             0      0 4194304    1 1024 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-2M             0      0 2097152    1  512 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-1M             0      0 1048576    1  256 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-512k           0      0 524288    1  128 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-256k           1      1 262144    1   64 : tunables    1    1    0 : slabdata      1      1      0 : globalstat       1      1     1    0    0    0    0    0    0 : cpustat      0      1      0      0
kmalloc-128k           0      0 131072    1   32 : tunables    8    4    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-64k            1      1  65536    1   16 : tunables    8    4    0 : slabdata      1      1      0 : globalstat       1      1     1    0    0    0    0    0    0 : cpustat      0      1      0      0
kmalloc-32k            1      1  32768    1    8 : tunables    8    4    0 : slabdata      1      1      0 : globalstat       1      1     1    0    0    0    0    0    0 : cpustat      0      1      0      0
kmalloc-16k            2      2  16384    1    4 : tunables    8    4    0 : slabdata      2      2      0 : globalstat     222      4   212  210    0    0    0    0    0 : cpustat   7107    220   7325      0
kmalloc-8k             9      9   8192    1    2 : tunables    8    4    0 : slabdata      9      9      0 : globalstat     503     20   155  146    0    4    0    0    0 : cpustat 22043876    253 22044039     82
kmalloc-4k            27     27   4096    1    1 : tunables   24   12    0 : slabdata     27     27      0 : globalstat     504    135   399  255    0   25    0    0    0 : cpustat   3415    419   3789     18
kmalloc-2k            54     54   2048    2    1 : tunables   24   12    0 : slabdata     27     27      0 : globalstat    2022     68    36    9    0    0    0    0    0 : cpustat    858    667   1474      0
kmalloc-1k           151    172   1024    4    1 : tunables   32   16    0 : slabdata     43     43      0 : globalstat    1056    196    54   11    0    3    0    0    0 : cpustat    453    153    453      2
kmalloc-512          302    320    512    8    1 : tunables   32   16    0 : slabdata     40     40      0 : globalstat    7933    400    51    3    0    2    0    0    0 : cpustat 2220216    547 2220469      8
kmalloc-256          293    304    256   16    1 : tunables   32   16    0 : slabdata     19     19      0 : globalstat 12361098   1616 53263  284    0    2    0    0    0 : cpustat 19771823 772713 19771803 772442
kmalloc-192          410    420    192   21    1 : tunables   32   16    0 : slabdata     20     20      0 : globalstat    3763    417    20    0    0    0    0    0    0 : cpustat 20526116    416 20526138      0
kmalloc-128          288    288    128   32    1 : tunables   32   16    0 : slabdata      9      9      0 : globalstat   11689    288    13    4    0    0    0    0    0 : cpustat  21015   1676  22409      0
kmalloc-96           666    966     96   42    1 : tunables   32   16    0 : slabdata     23     23      0 : globalstat  138190   1241    30    0    0    0    0    0    0 : cpustat 264861   8696 269873   3026
kmalloc-32        3317614 3317620     32  124    1 : tunables   32   16    0 : slabdata  26755  26755      0 : globalstat 3329656 3317661 26779   17    0    1    0    0    0 : cpustat 11621275 215178 8518750    104
kmalloc-64          3094   3136     64   64    1 : tunables   32   16    0 : slabdata     49     49      0 : globalstat 1643930   3440 20618    0    0    1    0    0    0 : cpustat 46206626 102866 46203878 102535
kmem_cache           169    189    192   21    1 : tunables   32   16    0 : slabdata      9      9      0 : globalstat     184    184     9    0    0    0    0    0    0 : cpustat    114     57      2      0

# cat /proc/meminfo
MemTotal:         122316 kB
MemFree:            1804 kB
MemAvailable:       2468 kB
Buffers:               0 kB
Cached:              716 kB
SwapCached:            0 kB
Active:             1148 kB
Inactive:            404 kB
Active(anon):        932 kB
Inactive(anon):      188 kB
Active(file):        216 kB
Inactive(file):      216 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:           884 kB
Mapped:              472 kB
Shmem:               236 kB
KReclaimable:       4284 kB
Slab:             115048 kB
SReclaimable:       4284 kB
SUnreclaim:       110764 kB
KernelStack:         296 kB
PageTables:          136 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:       61156 kB
Committed_AS:       5640 kB
VmallocTotal:     901120 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
Percpu:               64 kB

# cat /proc/slab_allocators ubi_wl_entry_slab: 3 erase_aeb+0x34/0xe0
ubi_wl_entry_slab: 805 ubi_wl_init+0x148/0x4e4
ubi_wl_entry_slab: 1155 ubi_wl_init+0x218/0x4e4
ubi_wl_entry_slab: 1 ubi_scan_fastmap+0x6f8/0x8fc
ubifs_inode_slab: 50 ubifs_alloc_inode+0x24/0x60
sd_ext_cdb: 2 mempool_alloc_slab+0x24/0x28
ip_fib_trie: 12 fib_insert_alias+0x40/0x298
ip_fib_alias: 15 fib_table_insert+0x33c/0x49c
eventpoll_pwq: 5 ep_ptable_queue_proc+0x38/0xb4
inotify_inode_mark: 15 sys_inotify_add_watch+0x12c/0x2bc
request_queue: 12 blk_alloc_queue_node+0x34/0x280
blkdev_ioc: 1 create_task_io_context+0x28/0xe0
configfs_dir_cache: 1 configfs_new_dirent+0x30/0xb4
file_lock_ctx: 1 locks_get_lock_context+0x48/0x10c
fsnotify_mark_connector: 15 fsnotify_add_mark_locked+0xbc/0x2b0
shmem_inode_cache: 545 shmem_alloc_inode+0x24/0x38
proc_dir_entry: 202 __proc_create+0x160/0x22c
proc_dir_entry: 1 proc_net_ns_init+0x28/0xd0
pde_opener: 1 proc_reg_open+0x7c/0x140
proc_inode_cache: 6 proc_alloc_inode+0x24/0x5c
seq_file: 1 seq_open+0x44/0xa4
kernfs_node_cache: 6152 __kernfs_new_node+0x48/0x174
inode_cache: 7258 alloc_inode+0x40/0xa8
dentry: 7872 __d_alloc+0x2c/0x1b4
nsproxy: 1 create_new_namespaces+0x34/0x144
vm_area_struct: 70 vm_area_alloc+0x28/0x68
vm_area_struct: 100 vm_area_dup+0x28/0x58
anon_vma_chain: 41 __anon_vma_prepare+0x28/0x124
anon_vma_chain: 51 anon_vma_clone+0x3c/0x168
anon_vma_chain: 40 anon_vma_fork+0x88/0x144
anon_vma: 72 __anon_vma_prepare+0x50/0x124
anon_vma: 40 anon_vma_fork+0x60/0x144
debug_objects_cache: 1024 debug_objects_mem_init+0x8c/0x248
trace_event_file: 1219 trace_create_new_event+0x24/0x6c
ftrace_event_field: 2953 __trace_define_field+0x30/0x98
radix_tree_node: 11 __radix_tree_preload.constprop.4+0x28/0x80
radix_tree_node: 125 radix_tree_node_alloc.constprop.5+0x54/0xd8
radix_tree_node: 11 radix_tree_node_alloc.constprop.5+0x8c/0xd8
radix_tree_node: 45 xas_alloc+0x40/0xb0

--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1056,8 +1056,6 @@ static int atmel_prepare_tx_dma(struct uart_port *port)
 	atmel_port->chan_tx = dma_request_slave_channel(mfd_dev, "tx");
 	if (atmel_port->chan_tx == NULL)
 		goto chan_err;
-	dev_info(port->dev, "using %s for tx DMA transfers\n",
-		dma_chan_name(atmel_port->chan_tx));
  	spin_lock_init(&atmel_port->lock_tx);
 	sg_init_table(&atmel_port->sg_tx, 1);
@@ -1239,8 +1237,6 @@ static int atmel_prepare_rx_dma(struct uart_port *port)

^ permalink raw reply

* DMA: atmel_serial: Opening and closing the serial device repeatedly causes kmalloc-32 slab leak
From: Richard Genoud @ 2018-11-27  9:51 UTC (permalink / raw)
  To: Ludovic Desroches, Nicolas Ferre, Maxime Ripard, Vinod Koul,
	Alexandre Belloni
  Cc: linux-arm-kernel@lists.infradead.org, dmaengine, Linux Kernel,
	linux-serial@vger.kernel.org, Mario Forner

[re-sending the bug report to the lists]
Le 16/11/2018 à 17:04, Mario Forner a écrit :
> Problem:
> When I open and close the serial device /dev/ttyS4 in a loop
> the amount of kmalloc-32 slabs increases slowly but steadily without limit.
> 
> The serial device is configured in acme-aria.dts to use DMA.
> 
> If DMA is disabled, the amount of kmalloc32-slabs remains constant
> over several hours, just fluctuating slightly.
> 
> The serial device is accessed by atmel_serial.c which is evident from
> the drivers kernel log output.
> 
> The bug was noticed on a device which had been running over several weeks and
> has accumulated ~86MB of unrelaimable kmalloc-32 slabs by now. Example:
> 
> root@master1083:~# slabtop -o | head -10
>  Active / Total Objects (% used)    : 2704880 / 2716124 (99.6%)
>  Active / Total Slabs (% used)      : 23150 / 23150 (100.0%)
>  Active / Total Caches (% used)     : 57 / 76 (75.0%)
>  Active / Total Size (% used)       : 88893.62K / 89964.32K (98.8%)
>  Minimum / Average / Maximum Object : 0.02K / 0.03K / 4096.00K
> 
>   OBJS ACTIVE  USE OBJ SIZE  SLABS OBJ/SLAB CACHE SIZE NAME
> 2674804 2673840  99%    0.03K  21571      124     86284K kmalloc-32
>   7200   7104  98%    0.08K    144       50       576K kernfs_node_cache
>   6930   5370  77%    0.13K    231       30       924K dentry     
> 
> root@master1083:~# uptime
>  15:12:55 up 93 days, 16:54,  1 user,  load average: 1.59, 2.31, 2.42 
> 
> Keywords:  atmel, serial, kernel, leak, memory, dma, slab, kmalloc
> 
> Kernel information:
> 
> Kernel version:
> Linux version 4.2.6 (mario@linux-7rm0) (gcc version 4.9.3 (crosstool-NG ) ) #115 Fri Nov 16 11:05:22 CET 2018
> Linux version 4.9.124 (mario@linux-7rm0) (gcc version 4.9.3 (crosstool-NG ) ) #16 Fri Nov 16 13:54:25 CET 2018   
> 
> Most recent Kernel version which did not have the bug:  unknown         
> 
> How to reproduce the bug:
> 
> The kmalloc-32 slab count should be monitored every few minutes with "slabtop -o".
> The leak can be triggered by running the following script, given DMA has
> been enabled for ttyS4:
> 
> #!/usr/bin/env python
> import serial
> import time
> 
> while True:
>     try:
>         with serial.Serial(port = '/dev/ttyS4'):
>             pass
>     except Exception as e:
>         print e
>     finally:
>         time.sleep(0.5)
> # end script
> 
> Environment:
> Software:
> Linux master 4.2.6 #114 Fri Nov 16 10:14:30 CET 2018 armv5tejl GNU/Linux
> 
> Binutils                2.25
> Util-linux              2.25.2
> Mount                   2.25.2
> Module-init-tools       18
> E2fsprogs               1.42.12
> Linux C Library         2.19
> Dynamic linker (ldd)    2.19
> Linux C++ Library       6.0.20
> Procps                  3.3.9
> Net-tools               1.60
> Sh-utils                8.23
> Udev                    215
> Modules Loaded          iptable_nat option usb_wwan usbserial  
> 
> Processor information:
> # cat /proc/cpuinfo
> processor       : 0
> model name      : ARM926EJ-S rev 5 (v5l)
> BogoMIPS        : 198.76
> Features        : swp half thumb fastmult edsp java
> CPU implementer : 0x41
> CPU architecture: 5TEJ
> CPU variant     : 0x0
> CPU part        : 0x926
> CPU revision    : 5
> 
> Hardware        : Atmel AT91SAM9
> Revision        : 0000
> Serial          : 0000000000000000  
> 
> Module information:
> # cat /proc/modules
> iptable_nat 1720 0 - Live 0xbf0a5000
> option 28780 0 - Live 0xbf03c000
> usb_wwan 6876 1 option, Live 0xbf024000
> usbserial 23392 2 option,usb_wwan, Live 0xbf000000
> 
> Loaded drivers:
> # cat /proc/ioports
> # cat /proc/iomem
> 00300000-00307fff : 300000.sram
> 00600000-006fffff : /ahb/ohci@00600000
> 00700000-007fffff : /ahb/ehci@00700000
> 20000000-2fffffff : System RAM
>   20008000-20577287 : Kernel code
>   205a8000-205f02b7 : Kernel data
> f0000000-f00000ff : /ahb/apb/spi@f0000000
> f8008000-f80080ff : /ahb/apb/timer@f8008000
> f800c000-f800c0ff : /ahb/apb/timer@f800c000
> f8010000-f80100ff : /ahb/apb/i2c@f8010000
> f8014000-f80140ff : /ahb/apb/i2c@f8014000
> f801c000-f801c1ff : atmel_serial
> f8020000-f80201ff : atmel_serial
> f8024000-f80241ff : atmel_serial
> f8028000-f80281ff : atmel_serial
> f802c000-f802c0ff : /ahb/apb/ethernet@f802c000
> f8034000-f80342ff : /ahb/apb/pwm@f8034000
> f804c000-f804c0ff : /ahb/apb/adc@f804c000
> ffffec00-ffffedff : at_hdmac
> ffffee00-ffffefff : at_hdmac
> fffff200-fffff3ff : atmel_serial
> fffff400-fffff5ff : /ahb/apb/pinctrl@fffff400/gpio@fffff400
> fffff600-fffff7ff : /ahb/apb/pinctrl@fffff400/gpio@fffff600
> fffff800-fffff9ff : /ahb/apb/pinctrl@fffff400/gpio@fffff800
> fffffa00-fffffbff : /ahb/apb/pinctrl@fffff400/gpio@fffffa00
> fffffe10-fffffe1f : /ahb/apb/shdwc@fffffe10
> 
> Other Information:
> The serial device ttyS4 is configuered inside .dts file by
> 
> usart3: serial@f8028000 {
>     status = "okay";
>     compatible = "atmel,at91sam9260-usart";
>     reg = <0xf8028000 0x200>;
>     interrupts = <8 IRQ_TYPE_LEVEL_HIGH 5>;
>     pinctrl-names = "default";
>     atmel,use-dma-tx;
>     atmel,use-dma-rx;
>     pinctrl-0 = <&pinctrl_usart3
>     &pinctrl_usart3_rts~
>     &pinctrl_usart3_cts>;
>     linux,rs485-enabled-at-boot-time;
>     rs485-rts-delay = <0 0>;
> };
> 
> Other notes:
> I tried the SLUB allocator with slub_debug=U but opening serial device then
> resulted in a Kernel-Oops:
>     at BUGON(ents < 0);
>     in function: dma_map_sg_attrs
>     in file: /include/asm-generic/dma-mapping-common.h
> So I could not gather information that way. I don't know if this is related.
> SLUB works if User Tracking is disabled.
> 
> Enabling kmemleak did not detect any leaks.
> 
> I also tried kernel version 4.19.1 and it exhibits the same behaviour, but I
> could not configure it to run reliably on the target system yet. 
> 

Hi all,

I reproduced the memory leak on my board (at91sam9g35-cm) with a 4.20-rc3.

It triggered an OOM after a couple of hours running a code like this:
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>


int main(int argc, char **argv)
{
	int fd;
	do {
		fd = open("/dev/ttyS1", O_RDONLY);
		close(fd);
	} while (true);
	return 0;
}

As Mario pointed out, this only happens when atmel,use-dma-{r,t}x are
used in the device-tree.

Adding:
CONFIG_DEBUG_SLAB=y
CONFIG_DEBUG_SLAB_LEAK=y
Doesn't show anything suspect in /proc/slab_allocators

From what I found until now, it's something done in :
dma_request_slave_channel();
that leaks kmalloc-32
Mabe I missed something, but it seems that everything DMA related is
deallocated in atmel_release_{tx,rx}_dma().

Is this ringing a bell ?



The oom-killer, slabinfo, meminfo and slab_allocator traces follow.

NB: the -dirty flag is there beacause I removed some log from atmel-serial:



OOM-killer trace :
[ 5220.560000] test_open invoked oom-killer: gfp_mask=0x6200ca(GFP_HIGHUSER_MOVABLE), nodemask=(null), order=0, oom_score_adj=0
[ 5220.580000] CPU: 0 PID: 1062 Comm: test_open Not tainted 4.20.0-rc3-dirty #31
[ 5220.580000] Hardware name: Atmel AT91SAM9
[ 5220.590000] Backtrace: 
[ 5220.590000] [<c000e020>] (dump_backtrace) from [<c000e2b8>] (show_stack+0x20/0x24)
[ 5220.600000]  r6:00000009 r5:c0649bb5 r4:c72a1e18 r3:02b88502
[ 5220.600000] [<c000e298>] (show_stack) from [<c0521114>] (dump_stack+0x20/0x28)
[ 5220.610000] [<c05210f4>] (dump_stack) from [<c0097280>] (dump_header+0x6c/0x1c4)
[ 5220.620000] [<c0097214>] (dump_header) from [<c0096454>] (oom_kill_process+0x6c/0x3cc)
[ 5220.620000]  r10:00000001 r8:c070e788 r7:c72a1e18 r6:00000009 r5:c0649bb5 r4:c7b64ea0
[ 5220.630000] [<c00963e8>] (oom_kill_process) from [<c009712c>] (out_of_memory+0x388/0x41c)
[ 5220.640000]  r10:00000001 r9:00000000 r8:c070e788 r7:0000000b r6:c070e8e4 r5:c070e788
[ 5220.650000]  r4:c72a1e18
[ 5220.650000] [<c0096da4>] (out_of_memory) from [<c009b1d8>] (__alloc_pages_nodemask+0x8b4/0xc48)
[ 5220.660000]  r8:00000011 r7:00000000 r6:00000000 r5:00000000 r4:006200ca
[ 5220.670000] [<c009a924>] (__alloc_pages_nodemask) from [<c0092bd4>] (filemap_fault+0x384/0x54c)
[ 5220.680000]  r10:c609b480 r9:00000000 r8:00000004 r7:00000000 r6:c72a1ed0 r5:c77dbb5c
[ 5220.680000]  r4:006200ca
[ 5220.690000] [<c0092850>] (filemap_fault) from [<c00babe8>] (__do_fault+0x28/0x9c)
[ 5220.690000]  r10:c7375a20 r9:c7375a58 r8:80000005 r7:000000b1 r6:b6efe000 r5:c72a1ed0
[ 5220.700000]  r4:00000000
[ 5220.700000] [<c00babc0>] (__do_fault) from [<c00bd9b0>] (handle_mm_fault+0x3e4/0x97c)
[ 5220.710000]  r5:000000c0 r4:00000000
[ 5220.720000] [<c00bd5cc>] (handle_mm_fault) from [<c000f774>] (do_page_fault+0x138/0x2ac)
[ 5220.720000]  r7:00000054 r6:b6efef9c r5:c72a1fb0 r4:c7a300e0
[ 5220.730000] [<c000f63c>] (do_page_fault) from [<c000f99c>] (do_translation_fault+0x2c/0xb4)
[ 5220.740000]  r10:b6f9e000 r9:00000000 r8:00053177 r7:80000005 r6:b6efef9c r5:c070f91c
[ 5220.750000]  r4:00000005
[ 5220.750000] [<c000f970>] (do_translation_fault) from [<c000fb38>] (do_PrefetchAbort+0x44/0x94)
[ 5220.760000]  r7:c72a1fb0 r6:b6efef9c r5:c070f91c r4:00000005
[ 5220.760000] [<c000faf4>] (do_PrefetchAbort) from [<c0009f08>] (ret_from_exception+0x0/0x18)
[ 5220.770000] Exception stack(0xc72a1fb0 to 0xc72a1ff8)
[ 5220.780000] 1fa0:                                     00000000 00000000 beb25d54 beb25e71
[ 5220.780000] 1fc0: 00000000 00000000 000082f4 00000006 00000000 00000000 b6f9e000 beb25bf4
[ 5220.790000] 1fe0: 00000000 beb25bdc 0000847c b6efef9c 40000010 ffffffff
[ 5220.800000]  r7:0005317f r6:ffffffff r5:40000010 r4:b6efef9c
[ 5220.800000] Mem-Info:
[ 5220.810000] active_anon:1659 inactive_anon:47 isolated_anon:0
[ 5220.810000]  active_file:2 inactive_file:4 isolated_file:0
[ 5220.810000]  unevictable:0 dirty:0 writeback:0 unstable:0
[ 5220.810000]  slab_reclaimable:1098 slab_unreclaimable:26200
[ 5220.810000]  mapped:3 shmem:60 pagetables:125 bounce:0
[ 5220.810000]  free:344 free_pcp:45 free_cma:0
[ 5220.840000] Node 0 active_anon:6636kB inactive_anon:188kB active_file:8kB inactive_file:16kB unevictable:0kB isolated(anon):0kB isolated(file):0kB mapped:12kB dirty:0kB writeback:0kB shmem:240kB writeback_tmp:0kB unstable:0kB all_unreclaimable? yes
[ 5220.860000] Normal free:1376kB min:1396kB low:1744kB high:2092kB active_anon:6636kB inactive_anon:188kB active_file:8kB inactive_file:16kB unevictable:0kB writepending:0kB present:131072kB managed:122316kB mlocked:0kB kernel_stack:448kB pagetables:500kB bounce:0kB free_pcp:180kB local_pcp:180kB free_cma:0kB
[ 5220.890000] lowmem_reserve[]: 0 0
[ 5220.890000] Normal: 0*4kB 54*8kB (U) 29*16kB (U) 11*32kB (U) 2*64kB (U) 0*128kB 0*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB = 1376kB
[ 5220.900000] 66 total pagecache pages
[ 5220.910000] 32768 pages RAM
[ 5220.910000] 0 pages HighMem/MovableOnly
[ 5220.910000] 2189 pages reserved
[ 5220.920000] Unreclaimable slab info:
[ 5220.920000] Name                      Used          Total
[ 5220.930000] ubi_wl_entry_slab         92KB         93KB
[ 5220.930000] bridge_fdb_cache           0KB          3KB
[ 5220.940000] fib6_nodes                 0KB          3KB
[ 5220.940000] ip6_dst_cache              0KB          3KB
[ 5220.950000] RAWv6                      4KB          7KB
[ 5220.950000] UDPv6                      1KB          7KB
[ 5220.960000] TCPv6                      3KB          6KB
[ 5220.960000] sd_ext_cdb                 0KB          3KB
[ 5220.970000] sgpool-128                 4KB          4KB
[ 5220.970000] sgpool-64                  2KB          4KB
[ 5220.980000] sgpool-32                  1KB          4KB
[ 5220.980000] sgpool-16                  0KB          4KB
[ 5220.990000] sgpool-8                   0KB          4KB
[ 5220.990000] nfs_commit_data            1KB          3KB
[ 5221.000000] nfs_write_data            18KB         19KB
[ 5221.000000] bio-1                      0KB          3KB
[ 5221.010000] rpc_buffers               16KB         16KB
[ 5221.010000] rpc_tasks                  1KB          4KB
[ 5221.020000] UNIX                      14KB         15KB
[ 5221.030000] tcp_bind_bucket            0KB          3KB
[ 5221.030000] ip_fib_trie                0KB          3KB
[ 5221.040000] ip_fib_alias               0KB          3KB
[ 5221.040000] ip_dst_cache               1KB          4KB
[ 5221.050000] RAW                        1KB          3KB
[ 5221.050000] UDP                        2KB          7KB
[ 5221.060000] TCP                        6KB          6KB
[ 5221.060000] eventpoll_pwq              0KB          3KB
[ 5221.070000] eventpoll_epi              1KB          3KB
[ 5221.070000] inotify_inode_mark          1KB          3KB
[ 5221.080000] request_queue             18KB         22KB
[ 5221.080000] blkdev_ioc                 0KB          3KB
[ 5221.090000] bio-0                      4KB          7KB
[ 5221.090000] biovec-max                90KB         90KB
[ 5221.100000] uid_cache                  0KB          3KB
[ 5221.100000] dmaengine-unmap-2          0KB          3KB
[ 5221.110000] skbuff_head_cache          5KB          7KB
[ 5221.110000] configfs_dir_cache          0KB          3KB
[ 5221.120000] file_lock_ctx              0KB          3KB
[ 5221.130000] fsnotify_mark_connector          0KB          3KB
[ 5221.130000] shmem_inode_cache        205KB        210KB
[ 5221.140000] proc_dir_entry            30KB         30KB
[ 5221.140000] pde_opener                 0KB          3KB
[ 5221.150000] seq_file                   0KB          3KB
[ 5221.150000] kernfs_node_cache        672KB        673KB
[ 5221.160000] mnt_cache                  5KB          7KB
[ 5221.160000] filp                      52KB         58KB
[ 5221.170000] names_cache               24KB         24KB
[ 5221.170000] key_jar                    0KB          4KB
[ 5221.180000] nsproxy                    0KB          3KB
[ 5221.180000] vm_area_struct            92KB        103KB
[ 5221.190000] mm_struct                 12KB         14KB
[ 5221.190000] fs_cache                   0KB          3KB
[ 5221.200000] files_cache                5KB         11KB
[ 5221.200000] signal_cache              33KB         46KB
[ 5221.210000] sighand_cache             71KB         80KB
[ 5221.210000] task_struct               57KB         86KB
[ 5221.220000] cred_jar                  13KB         20KB
[ 5221.220000] anon_vma_chain            32KB         46KB
[ 5221.230000] anon_vma                  29KB         39KB
[ 5221.240000] pid                        4KB          7KB
[ 5221.240000] debug_objects_cache         48KB         50KB
[ 5221.250000] trace_event_file          85KB         86KB
[ 5221.250000] ftrace_event_field        161KB        163KB
[ 5221.260000] pool_workqueue             1KB          4KB
[ 5221.260000] kmalloc-256k             256KB        256KB
[ 5221.270000] kmalloc-64k               64KB         64KB
[ 5221.270000] kmalloc-32k               32KB         32KB
[ 5221.280000] kmalloc-16k               32KB         32KB
[ 5221.280000] kmalloc-8k               128KB        128KB
[ 5221.290000] kmalloc-4k               104KB        104KB
[ 5221.290000] kmalloc-2k               102KB        108KB
[ 5221.300000] kmalloc-1k               191KB        192KB
[ 5221.300000] kmalloc-512              154KB        168KB
[ 5221.310000] kmalloc-256               64KB         80KB
[ 5221.310000] kmalloc-192               78KB         78KB
[ 5221.320000] kmalloc-128               22KB         24KB
[ 5221.320000] kmalloc-96                60KB         98KB
[ 5221.330000] kmalloc-32             97766KB      97770KB
[ 5221.340000] kmalloc-64               173KB        176KB
[ 5221.340000] kmem_cache                31KB         35KB
[ 5221.350000] Tasks state (memory values in pages):
[ 5221.350000] [  pid  ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
[ 5221.360000] [    617]     0   617      458       30     8192        0             0 bootlogd
[ 5221.370000] [    653]     0   653      776       11     8192        0             0 syslogd
[ 5221.380000] [    656]     0   656      776       12     6144        0             0 klogd
[ 5221.380000] [    676]     0   676     1578      299    10240        0             0 conf-manager
[ 5221.390000] [    679]     0   679      484       27     6144        0             0 conf-dispatcher
[ 5221.400000] [    688]     0   688      432       17     8192        0             0 keypad
[ 5221.410000] [    700]     0   700      904       79     8192        0         -1000 udevd
[ 5221.420000] [    717]    81   717     1074       49     8192        0             0 dbus-daemon
[ 5221.430000] [    747]     0   747      776       11     8192        0             0 respawn.sh
[ 5221.440000] [    749]     0   749     1493       69    10240        0             0 connmand
[ 5221.440000] [    751]    99   751      581       27     6144        0             0 dnsmasq
[ 5221.450000] [    755]     0   755      572       21     6144        0             0 dropbear
[ 5221.460000] [    759]     0   759     1083       75    10240        0             0 lighttpd
[ 5221.470000] [    761]     0   761     4393      291    20480        0             0 php-cgi
[ 5221.480000] [    763]     0   763     4393      291    22528        0             0 php-cgi
[ 5221.490000] [    768]     0   768      777       39     6144        0             0 lns_networking.
[ 5221.500000] [    839]     0   839      455       23     6144        0             0 inotifywait
[ 5221.500000] [    897]     0   897      776        9     6144        0             0 ntpd
[ 5221.510000] [    905]     0   905     1404       22     8192        0             0 crond
[ 5221.520000] [    922]     0   922      484       21     8192        0             0 event-monitor
[ 5221.530000] [    941]     0   941     1011       29     8192        0             0 sh
[ 5221.540000] [   1062]     0  1062      383       11     6144        0             0 test_open
[ 5221.550000] [   1063]     0  1063      592       31     8192        0             0 dropbear
[ 5221.550000] [   1064]     0  1064     1011       30     8192        0             0 sh
[ 5221.560000] [   5315]     0  5315      776       15     6144        0             0 check_online.sh
[ 5221.570000] [   5316]     0  5316      776       15     4096        0             0 check_online.sh
[ 5221.580000] [   5317]     0  5317     1159       53    10240        0             0 socat
[ 5221.590000] [   5318]     0  5318     1016       37    10240        0             0 xsltproc
[ 5221.600000] [   5319]     0  5319      777        9     8192        0             0 uniq
[ 5221.610000] Out of memory: Kill process 676 (conf-manager) score 9 or sacrifice child
[ 5221.610000] Killed process 676 (conf-manager) total-vm:6312kB, anon-rss:1196kB, file-rss:0kB, shmem-rss:0kB


full stabinfo:
slabinfo - version: 2.1 (statistics)
# name            <active_objs> <num_objs> <objsize> <objperslab> <pagesperslab> : tunables <limit> <batchcount> <sharedfactor> : slabdata <active_slabs> <num_slabs> <sharedavail> : globalstat <listallocs> <maxobjs> <grown> <reaped> <error> <maxfreeable> <nodeallocs> <remotefrees> <alienoverflow> : cpustat <allochit> <allocmiss> <freehit> <freemiss>
ubi_wl_entry_slab   1964   1992     48   83    1 : tunables   32   16    0 : slabdata     24     24      0 : globalstat    1973   1973    24    0    0    0    0    0    0 : cpustat   1822    142      0      0
ubifs_inode_slab      66    189    432    9    1 : tunables   32   16    0 : slabdata     21     21      0 : globalstat   92965    477    53    0    0    0    0    0    0 : cpustat 354826   5836 355569   5041
bridge_fdb_cache       2     63     64   63    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      48     17     1    0    0    0    0    0    0 : cpustat      1      3      2      0
nf-frags               0      0    152   26    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
xfrm6_tunnel_spi       0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ip6-frags              0      0    152   26    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
fib6_nodes             6     63     64   63    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      32     17     1    0    0    0    0    0    0 : cpustat      4      2      0      0
ip6_dst_cache          3     25    160   25    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat     640     19     1    0    0    0    0    0    0 : cpustat     32     40     69      0
PINGv6                 0      0    832    9    2 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
RAWv6                  5      9    832    9    2 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      13      9     1    0    0    0    0    0    0 : cpustat      4      2      1      0
UDPLITEv6              0      0    832    9    2 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
UDPv6                  1      9    832    9    2 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      17      9     1    0    0    0    0    0    0 : cpustat      4      2      5      0
tw_sock_TCPv6          0      0    200   20    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
request_sock_TCPv6      0      0    256   16    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
TCPv6                  1      4   1760    4    2 : tunables   24   12    0 : slabdata      1      1      0 : globalstat       4      4     1    0    0    0    0    0    0 : cpustat      1      1      1      0
nf_conntrack_expect      0      0    152   26    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
nf_conntrack           0      0    192   21    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
sd_ext_cdb             2     71     56   71    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      1      1      0      0
sgpool-128             2      2   2048    2    1 : tunables   24   12    0 : slabdata      1      1      0 : globalstat       2      2     1    0    0    0    0    0    0 : cpustat      1      1      0      0
sgpool-64              2      4   1024    4    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat       4      4     1    0    0    0    0    0    0 : cpustat      1      1      0      0
sgpool-32              2      8    512    8    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat       8      8     1    0    0    0    0    0    0 : cpustat      1      1      0      0
sgpool-16              2     16    256   16    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      1      1      0      0
sgpool-8               2     32    128   32    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      1      1      0      0
nfs_direct_cache       0      0    208   19    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
nfs_commit_data        4      9    448    9    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat       9      9     1    0    0    0    0    0    0 : cpustat      3      1      0      0
nfs_write_data        32     35    576    7    1 : tunables   32   16    0 : slabdata      5      5      0 : globalstat      35     35     5    0    0    0    0    0    0 : cpustat     27      5      0      0
nfs_read_data          0      0    576    7    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
nfs_inode_cache        0      0    608    6    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
nfs_page               0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
fat_inode_cache        0      0    424    9    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
fat_cache              0      0     48   83    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
jbd2_transaction_s      0      0    160   25    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
jbd2_inode             0      0     48   83    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
jbd2_journal_handle      0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
jbd2_journal_head      0      0     88   46    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
jbd2_revoke_table_s      0      0     40   99    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
jbd2_revoke_record_s      0      0     32  124    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_inode_cache       0      0    624    6    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_free_data         0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_allocation_context      0      0    128   32    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_prealloc_space      0      0     88   46    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_system_zone       0      0     56   71    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_io_end            0      0     72   56    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_pending_reservation      0      0     40   99    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ext4_extent_status      0      0     56   71    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
mbcache                0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kioctx                 0      0    224   18    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
aio_kiocb              0      0     96   42    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
fanotify_event_info      0      0     56   71    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
fsnotify_mark          0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
dnotify_mark           0      0     72   56    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
dnotify_struct         0      0     48   83    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
dio                    0      0    360   11    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
bio-1                  4     25    160   25    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      3      1      0      0
fasync_cache           0      0     48   83    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
posix_timers_cache      0      0    192   21    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
rpc_inode_cache        0      0    352   11    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
rpc_buffers            8      8   2048    2    1 : tunables   24   12    0 : slabdata      4      4      0 : globalstat       8      8     4    0    0    0    0    0    0 : cpustat      4      4      0      0
rpc_tasks              8     32    128   32    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      7      1      0      0
UNIX                   7     28    576    7    1 : tunables   32   16    0 : slabdata      4      4      0 : globalstat   65532     35    88   84    0    0    0    0    0 : cpustat  20071   4224  24288      0
ip4-frags              0      0    160   25    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
UDP-Lite               0      0    704   11    2 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
tcp_bind_bucket        1     63     64   63    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      4      1      4      0
inet_peer_cache        0      0    128   32    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
secpath_cache          0      0     64   63    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
xfrm_dst_cache         0      0    224   18    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
xfrm_state             0      0    576    7    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
ip_fib_trie           12     71     56   71    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      32     19     1    0    0    0    0    0    0 : cpustat     11      2      1      0
ip_fib_alias          15     71     56   71    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      32     20     1    0    0    0    0    0    0 : cpustat     14      2      1      0
ip_dst_cache          10     32    128   32    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat    1824     24     1    0    0    0    0    0    0 : cpustat    116    114    222      0
PING                   0      0    672    6    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
RAW                    2      6    672    6    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      10      6     1    0    0    0    0    0    0 : cpustat     12      2     12      0
UDP                    0      0    704   11    2 : tunables   32   16    0 : slabdata      0      0      0 : globalstat     994     11     2    2    0    0    0    0    0 : cpustat    580    123    703      0
tw_sock_TCP            0      0    200   20    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
request_sock_TCP       0      0    256   16    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat      16     16     1    1    0    0    0    0    0 : cpustat      0      1      1      0
TCP                    1      4   1664    4    2 : tunables   24   12    0 : slabdata      1      1      0 : globalstat       5      4     1    0    0    0    0    0    0 : cpustat     11      2     12      0
eventpoll_pwq          5     63     64   63    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat    1392     48     1    0    0    0    0    0    0 : cpustat     61     87    142      1
eventpoll_epi          5     42     96   42    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat    1386     42     1    0    0    0    0    0    0 : cpustat     61     87    143      0
inotify_inode_mark     15     56     72   56    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      48     39     1    0    0    0    0    0    0 : cpustat     21      3      9      0
scsi_data_buffer       0      0     48   83    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
request_queue         12     15   1536    5    2 : tunables   24   12    0 : slabdata      3      3      0 : globalstat      15     15     3    0    0    0    0    0    0 : cpustat      9      3      0      0
blkdev_requests        0      0    216   18    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
blkdev_ioc             1     51     80   51    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      0      1      0      0
bio-0                 26     50    160   25    1 : tunables   32   16    0 : slabdata      2      2      0 : globalstat      41     41     2    0    0    0    0    0    0 : cpustat     27      3      4      0
biovec-max            30     30   3072    2    2 : tunables   24   12    0 : slabdata     15     15      0 : globalstat      30     30    15    0    0    0    0    0    0 : cpustat     15     15      0      0
biovec-128             0      0   1536    5    2 : tunables   24   12    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
biovec-64              0      0    768    5    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
biovec-16              0      0    192   21    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
uid_cache              0      0     96   42    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat      16     16     1    1    0    0    0    0    0 : cpustat      1      1      2      0
dmaengine-unmap-2      1    124     32  124    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      0      1      0      0
sock_inode_cache      26     66    352   11    1 : tunables   32   16    0 : slabdata      6      6      0 : globalstat   55763     77     7    0    0    0    0    0    0 : cpustat   7743   3489  11206      0
skbuff_fclone_cache      0      0    384   10    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat    5630     10   552  552    0    0    0    0    0 : cpustat    122    563    685      0
skbuff_head_cache     12     42    192   21    1 : tunables   32   16    0 : slabdata      2      2      0 : globalstat   56541    121     6    1    0    0    0    0    0 : cpustat  24027   3924  27932      9
configfs_dir_cache      1     51     80   51    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      0      1      0      0
file_lock_cache        0      0    144   28    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat    1696     18   103  103    0    0    0    0    0 : cpustat   1338    106   1444      0
file_lock_ctx          1     83     48   83    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      0      1      0      0
fsnotify_mark_connector     15     99     40   99    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      32     32     1    0    0    0    0    0    0 : cpustat     20      2      7      0
shmem_inode_cache    545    560    384   10    1 : tunables   32   16    0 : slabdata     56     56      0 : globalstat     573    560    56    0    0    0    0    0    0 : cpustat    533     58     46      0
proc_dir_entry       203    208    152   26    1 : tunables   32   16    0 : slabdata      8      8      0 : globalstat     232    208     8    0    0    0    0    0    0 : cpustat 1655734     19 1655550      0
pde_opener            16     83     48   83    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat    3392     16   208  207    0    0    0    0    0 : cpustat    379    212    590      0
proc_inode_cache      19     20    384   10    1 : tunables   32   16    0 : slabdata      2      2      0 : globalstat   65673    330    58   24    0    2    0    0    0 : cpustat  17629   9256  26850     29
seq_file              16     39    104   39    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat    3440     19     4    3    0    0    0    0    0 : cpustat   1822    215   2036      0
sigqueue               0      0     72   56    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat     496     25    28   28    0    0    0    0    0 : cpustat     22     31     53      0
bdev_cache            13     18    448    9    1 : tunables   32   16    0 : slabdata      2      2      0 : globalstat      26     18     2    0    0    0    0    0    0 : cpustat     14      3      4      0
kernfs_node_cache   6152   6156    112   36    1 : tunables   32   16    0 : slabdata    171    171      0 : globalstat    6164   6152   171    0    0    0    0    0    0 : cpustat   6046    512    406      0
mnt_cache             23     36    224   18    1 : tunables   32   16    0 : slabdata      2      2      0 : globalstat      34     34     2    0    0    0    0    0    0 : cpustat     20      3      0      0
filp                  94    325    160   25    1 : tunables   32   16    0 : slabdata     13     13      0 : globalstat   56563    366    16    1    0    1    0    0    0 : cpustat 2140672   3542 2141060   3073
inode_cache         7258   7260    344   11    1 : tunables   32   16    0 : slabdata    660    660      0 : globalstat    9668   8316   828   77    0    0    0    0    0 : cpustat   9994    928   3600     64
dentry              7885   8800    160   25    1 : tunables   32   16    0 : slabdata    352    352      0 : globalstat  209061   9941   398    0    0    1    0    0    0 : cpustat 579132  13240 572829  11669
names_cache            1      1   4096    1    1 : tunables   24   12    0 : slabdata      1      1      0 : globalstat    1216     11   965  964    0    0    0    0    0 : cpustat 2313916   1211 2315127      0
key_jar                3     32    128   32    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      2      1      0      0
buffer_head            0      0     88   46    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat      16     16     1    1    0    0    0    0    0 : cpustat      3      1      4      0
nsproxy                1     71     56   71    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      0      1      0      0
vm_area_struct       196    646    120   34    1 : tunables   32   16    0 : slabdata     19     19      0 : globalstat  493665   1326    41    1    0    1    0    0    0 : cpustat 1030662  30889 1031088  30293
mm_struct             25     36    416    9    1 : tunables   32   16    0 : slabdata      4      4      0 : globalstat   19979     45     5    1    0    0    0    0    0 : cpustat  44416   1297  45703      0
fs_cache              18    124     32  124    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat    1904    112     1    0    0    0    0    0    0 : cpustat  23929    119  24029      9
files_cache           18     63    192   21    1 : tunables   32   16    0 : slabdata      3      3      0 : globalstat    1913    105     5    0    0    0    0    0    0 : cpustat  23925    123  24028     10
signal_cache          45     72    608    6    1 : tunables   32   16    0 : slabdata     12     12      0 : globalstat   15230    120    20    1    0    0    0    0    0 : cpustat  23152    965  24070     10
sighand_cache         43     57   1312    3    1 : tunables   24   12    0 : slabdata     19     19      0 : globalstat    1401    117    48    8    0    6    0    0    0 : cpustat  23947    170  24066     14
task_struct           43     84   1056    7    2 : tunables   24   12    0 : slabdata     12     12      0 : globalstat   11531    119    18    0    0    1    0    0    0 : cpustat  23150    969  24064     18
cred_jar              70    160    128   32    1 : tunables   32   16    0 : slabdata      5      5      0 : globalstat   20529    144     5    0    0    0    0    0    0 : cpustat  56391   1284  57604     15
anon_vma_chain       161    781     56   71    1 : tunables   32   16    0 : slabdata     11     11      0 : globalstat  139671   1381    21    1    0    1    0    0    0 : cpustat 472282   8741 473000   7891
anon_vma             125    567     64   63    1 : tunables   32   16    0 : slabdata      9      9      0 : globalstat   68139    741    12    0    0    0    0    0    0 : cpustat 329676   4260 330198   3626
pid                   50    126     64   63    1 : tunables   32   16    0 : slabdata      2      2      0 : globalstat   15054    126     2    0    0    0    0    0    0 : cpustat  23178    941  24066     11
debug_objects_cache   1024   1079     48   83    1 : tunables   32   16    0 : slabdata     13     13      0 : globalstat    1028   1028    13    0    0    0    0    0    0 : cpustat    950     74      0      0
trace_event_file    1219   1232     72   56    1 : tunables   32   16    0 : slabdata     22     22      0 : globalstat    1219   1219    22    0    0    0    0    0    0 : cpustat      0   1219      0      0
ftrace_event_field   2953   2982     56   71    1 : tunables   32   16    0 : slabdata     42     42      0 : globalstat    2959   2959    42    0    0    0    0    0    0 : cpustat   2745    208      0      0
pool_workqueue         4     16    256   16    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      2      2      0      0
radix_tree_node      193    300    328   12    1 : tunables   32   16    0 : slabdata     25     25      0 : globalstat   60882    396    33    0    0    0    0    0    0 : cpustat 234553   3841 234990   3211
kmalloc-rcl-4M         0      0 4194304    1 1024 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-2M         0      0 2097152    1  512 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-1M         0      0 1048576    1  256 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-512k       0      0 524288    1  128 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-256k       0      0 262144    1   64 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-128k       0      0 131072    1   32 : tunables    8    4    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-64k        0      0  65536    1   16 : tunables    8    4    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-32k        0      0  32768    1    8 : tunables    8    4    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-16k        0      0  16384    1    4 : tunables    8    4    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-8k         0      0   8192    1    2 : tunables    8    4    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-4k         0      0   4096    1    1 : tunables   24   12    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-2k         0      0   2048    2    1 : tunables   24   12    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-1k         0      0   1024    4    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-512        0      0    512    8    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-256        0      0    256   16    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-192        0      0    192   21    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-128        0      0    128   32    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-96         0      0     96   42    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-rcl-64         1     64     64   64    1 : tunables   32   16    0 : slabdata      1      1      0 : globalstat      16     16     1    0    0    0    0    0    0 : cpustat      0      1      0      0
kmalloc-rcl-32         0      0     32  124    1 : tunables   32   16    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-4M             0      0 4194304    1 1024 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-2M             0      0 2097152    1  512 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-1M             0      0 1048576    1  256 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-512k           0      0 524288    1  128 : tunables    1    1    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-256k           1      1 262144    1   64 : tunables    1    1    0 : slabdata      1      1      0 : globalstat       1      1     1    0    0    0    0    0    0 : cpustat      0      1      0      0
kmalloc-128k           0      0 131072    1   32 : tunables    8    4    0 : slabdata      0      0      0 : globalstat       0      0     0    0    0    0    0    0    0 : cpustat      0      0      0      0
kmalloc-64k            1      1  65536    1   16 : tunables    8    4    0 : slabdata      1      1      0 : globalstat       1      1     1    0    0    0    0    0    0 : cpustat      0      1      0      0
kmalloc-32k            1      1  32768    1    8 : tunables    8    4    0 : slabdata      1      1      0 : globalstat       1      1     1    0    0    0    0    0    0 : cpustat      0      1      0      0
kmalloc-16k            2      2  16384    1    4 : tunables    8    4    0 : slabdata      2      2      0 : globalstat     222      4   212  210    0    0    0    0    0 : cpustat   7107    220   7325      0
kmalloc-8k             9      9   8192    1    2 : tunables    8    4    0 : slabdata      9      9      0 : globalstat     503     20   155  146    0    4    0    0    0 : cpustat 22043876    253 22044039     82
kmalloc-4k            27     27   4096    1    1 : tunables   24   12    0 : slabdata     27     27      0 : globalstat     504    135   399  255    0   25    0    0    0 : cpustat   3415    419   3789     18
kmalloc-2k            54     54   2048    2    1 : tunables   24   12    0 : slabdata     27     27      0 : globalstat    2022     68    36    9    0    0    0    0    0 : cpustat    858    667   1474      0
kmalloc-1k           151    172   1024    4    1 : tunables   32   16    0 : slabdata     43     43      0 : globalstat    1056    196    54   11    0    3    0    0    0 : cpustat    453    153    453      2
kmalloc-512          302    320    512    8    1 : tunables   32   16    0 : slabdata     40     40      0 : globalstat    7933    400    51    3    0    2    0    0    0 : cpustat 2220216    547 2220469      8
kmalloc-256          293    304    256   16    1 : tunables   32   16    0 : slabdata     19     19      0 : globalstat 12361098   1616 53263  284    0    2    0    0    0 : cpustat 19771823 772713 19771803 772442
kmalloc-192          410    420    192   21    1 : tunables   32   16    0 : slabdata     20     20      0 : globalstat    3763    417    20    0    0    0    0    0    0 : cpustat 20526116    416 20526138      0
kmalloc-128          288    288    128   32    1 : tunables   32   16    0 : slabdata      9      9      0 : globalstat   11689    288    13    4    0    0    0    0    0 : cpustat  21015   1676  22409      0
kmalloc-96           666    966     96   42    1 : tunables   32   16    0 : slabdata     23     23      0 : globalstat  138190   1241    30    0    0    0    0    0    0 : cpustat 264861   8696 269873   3026
kmalloc-32        3317614 3317620     32  124    1 : tunables   32   16    0 : slabdata  26755  26755      0 : globalstat 3329656 3317661 26779   17    0    1    0    0    0 : cpustat 11621275 215178 8518750    104
kmalloc-64          3094   3136     64   64    1 : tunables   32   16    0 : slabdata     49     49      0 : globalstat 1643930   3440 20618    0    0    1    0    0    0 : cpustat 46206626 102866 46203878 102535
kmem_cache           169    189    192   21    1 : tunables   32   16    0 : slabdata      9      9      0 : globalstat     184    184     9    0    0    0    0    0    0 : cpustat    114     57      2      0

# cat /proc/meminfo
MemTotal:         122316 kB
MemFree:            1804 kB
MemAvailable:       2468 kB
Buffers:               0 kB
Cached:              716 kB
SwapCached:            0 kB
Active:             1148 kB
Inactive:            404 kB
Active(anon):        932 kB
Inactive(anon):      188 kB
Active(file):        216 kB
Inactive(file):      216 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:           884 kB
Mapped:              472 kB
Shmem:               236 kB
KReclaimable:       4284 kB
Slab:             115048 kB
SReclaimable:       4284 kB
SUnreclaim:       110764 kB
KernelStack:         296 kB
PageTables:          136 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:       61156 kB
Committed_AS:       5640 kB
VmallocTotal:     901120 kB
VmallocUsed:           0 kB
VmallocChunk:          0 kB
Percpu:               64 kB

# cat /proc/slab_allocators 
ubi_wl_entry_slab: 3 erase_aeb+0x34/0xe0
ubi_wl_entry_slab: 805 ubi_wl_init+0x148/0x4e4
ubi_wl_entry_slab: 1155 ubi_wl_init+0x218/0x4e4
ubi_wl_entry_slab: 1 ubi_scan_fastmap+0x6f8/0x8fc
ubifs_inode_slab: 50 ubifs_alloc_inode+0x24/0x60
sd_ext_cdb: 2 mempool_alloc_slab+0x24/0x28
ip_fib_trie: 12 fib_insert_alias+0x40/0x298
ip_fib_alias: 15 fib_table_insert+0x33c/0x49c
eventpoll_pwq: 5 ep_ptable_queue_proc+0x38/0xb4
inotify_inode_mark: 15 sys_inotify_add_watch+0x12c/0x2bc
request_queue: 12 blk_alloc_queue_node+0x34/0x280
blkdev_ioc: 1 create_task_io_context+0x28/0xe0
configfs_dir_cache: 1 configfs_new_dirent+0x30/0xb4
file_lock_ctx: 1 locks_get_lock_context+0x48/0x10c
fsnotify_mark_connector: 15 fsnotify_add_mark_locked+0xbc/0x2b0
shmem_inode_cache: 545 shmem_alloc_inode+0x24/0x38
proc_dir_entry: 202 __proc_create+0x160/0x22c
proc_dir_entry: 1 proc_net_ns_init+0x28/0xd0
pde_opener: 1 proc_reg_open+0x7c/0x140
proc_inode_cache: 6 proc_alloc_inode+0x24/0x5c
seq_file: 1 seq_open+0x44/0xa4
kernfs_node_cache: 6152 __kernfs_new_node+0x48/0x174
inode_cache: 7258 alloc_inode+0x40/0xa8
dentry: 7872 __d_alloc+0x2c/0x1b4
nsproxy: 1 create_new_namespaces+0x34/0x144
vm_area_struct: 70 vm_area_alloc+0x28/0x68
vm_area_struct: 100 vm_area_dup+0x28/0x58
anon_vma_chain: 41 __anon_vma_prepare+0x28/0x124
anon_vma_chain: 51 anon_vma_clone+0x3c/0x168
anon_vma_chain: 40 anon_vma_fork+0x88/0x144
anon_vma: 72 __anon_vma_prepare+0x50/0x124
anon_vma: 40 anon_vma_fork+0x60/0x144
debug_objects_cache: 1024 debug_objects_mem_init+0x8c/0x248
trace_event_file: 1219 trace_create_new_event+0x24/0x6c
ftrace_event_field: 2953 __trace_define_field+0x30/0x98
radix_tree_node: 11 __radix_tree_preload.constprop.4+0x28/0x80
radix_tree_node: 125 radix_tree_node_alloc.constprop.5+0x54/0xd8
radix_tree_node: 11 radix_tree_node_alloc.constprop.5+0x8c/0xd8
radix_tree_node: 45 xas_alloc+0x40/0xb0

--- a/drivers/tty/serial/atmel_serial.c
+++ b/drivers/tty/serial/atmel_serial.c
@@ -1056,8 +1056,6 @@ static int atmel_prepare_tx_dma(struct uart_port *port)
 	atmel_port->chan_tx = dma_request_slave_channel(mfd_dev, "tx");
 	if (atmel_port->chan_tx == NULL)
 		goto chan_err;
-	dev_info(port->dev, "using %s for tx DMA transfers\n",
-		dma_chan_name(atmel_port->chan_tx));
 
 	spin_lock_init(&atmel_port->lock_tx);
 	sg_init_table(&atmel_port->sg_tx, 1);
@@ -1239,8 +1237,6 @@ static int atmel_prepare_rx_dma(struct uart_port *port)
 	atmel_port->chan_rx = dma_request_slave_channel(mfd_dev, "rx");
 	if (atmel_port->chan_rx == NULL)
 		goto chan_err;
-	dev_info(port->dev, "using %s for rx DMA transfers\n",
-		dma_chan_name(atmel_port->chan_rx));
 
 	spin_lock_init(&atmel_port->lock_rx);
 	sg_init_table(&atmel_port->sg_rx, 1);

^ permalink raw reply

* [V2] mm: Replace all open encodings for NUMA_NO_NODE
From: Michael Ellerman @ 2018-11-27  7:57 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm, linux-kernel
  Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, intel-wired-lan,
	linux-media, iommu, linux-rdma, dmaengine, linux-block,
	sparclinux, linuxppc-dev, linux-ia64, linux-alpha, akpm,
	jiangqi903, hverkuil, vkoul

Anshuman Khandual <anshuman.khandual@arm.com> writes:
> At present there are multiple places where invalid node number is encoded
> as -1. Even though implicitly understood it is always better to have macros
> in there. Replace these open encodings for an invalid node number with the
> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
> 'invalid node' from various places redirecting them to a common definition.
>
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> Changes in V2:
>
> - Added inclusion of 'numa.h' header at various places per Andrew
> - Updated 'dev_to_node' to use NUMA_NO_NODE instead per Vinod
>
> Changes in V1: (https://lkml.org/lkml/2018/11/23/485)
>
> - Dropped OCFS2 changes per Joseph
> - Dropped media/video drivers changes per Hans
>
> RFC - https://patchwork.kernel.org/patch/10678035/
>
> Build tested this with multiple cross compiler options like alpha, sparc,
> arm64, x86, powerpc, powerpc64le etc with their default config which might
> not have compiled tested all driver related changes. I will appreciate
> folks giving this a test in their respective build environment.
>
> All these places for replacement were found by running the following grep
> patterns on the entire kernel code. Please let me know if this might have
> missed some instances. This might also have replaced some false positives.
> I will appreciate suggestions, inputs and review.
>
> 1. git grep "nid == -1"
> 2. git grep "node == -1"
> 3. git grep "nid = -1"
> 4. git grep "node = -1"
>
>  arch/alpha/include/asm/topology.h             |  3 ++-
>  arch/ia64/kernel/numa.c                       |  2 +-
>  arch/ia64/mm/discontig.c                      |  6 +++---
>  arch/ia64/sn/kernel/io_common.c               |  3 ++-
>  arch/powerpc/include/asm/pci-bridge.h         |  3 ++-
>  arch/powerpc/kernel/paca.c                    |  3 ++-
>  arch/powerpc/kernel/pci-common.c              |  3 ++-
>  arch/powerpc/mm/numa.c                        | 14 +++++++-------
>  arch/powerpc/platforms/powernv/memtrace.c     |  5 +++--

These powerpc changes all look fine.

Acked-by: Michael Ellerman <mpe@ellerman.id.au>


cheers

^ permalink raw reply

* [V2] mm: Replace all open encodings for NUMA_NO_NODE
From: Jens Axboe @ 2018-11-26 18:04 UTC (permalink / raw)
  To: jeffrey.t.kirsher, Anshuman Khandual, linux-mm, linux-kernel
  Cc: hverkuil, linux-fbdev, linux-ia64, linux-rdma, netdev, vkoul,
	dri-devel, linux-block, sparclinux, iommu, intel-wired-lan,
	linux-alpha, dmaengine, jiangqi903, akpm, linuxppc-dev,
	ocfs2-devel, linux-media

On 11/26/18 10:56 AM, Jeff Kirsher wrote:
> On Mon, 2018-11-26 at 17:56 +0530, Anshuman Khandual wrote:
>> At present there are multiple places where invalid node number is
>> encoded
>> as -1. Even though implicitly understood it is always better to have
>> macros
>> in there. Replace these open encodings for an invalid node number
>> with the
>> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions
>> like
>> 'invalid node' from various places redirecting them to a common
>> definition.
>>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> 
> For the 'ixgbe' driver changes.
> 
> Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Lost the original, but for mtip32xx:

Acked-by: Jens Axboe <axboe@kernel.dk>

^ permalink raw reply

* [V2] mm: Replace all open encodings for NUMA_NO_NODE
From: Jeff Kirsher @ 2018-11-26 17:56 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm, linux-kernel
  Cc: hverkuil, linux-fbdev, linux-ia64, linux-rdma, netdev, vkoul,
	dri-devel, linux-block, sparclinux, iommu, intel-wired-lan,
	linux-alpha, dmaengine, jiangqi903, akpm, linuxppc-dev,
	ocfs2-devel, linux-media

On Mon, 2018-11-26 at 17:56 +0530, Anshuman Khandual wrote:
> At present there are multiple places where invalid node number is
> encoded
> as -1. Even though implicitly understood it is always better to have
> macros
> in there. Replace these open encodings for an invalid node number
> with the
> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions
> like
> 'invalid node' from various places redirecting them to a common
> definition.
> 
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>

For the 'ixgbe' driver changes.

Acked-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>


> ---
> Changes in V2:
> 
> - Added inclusion of 'numa.h' header at various places per Andrew
> - Updated 'dev_to_node' to use NUMA_NO_NODE instead per Vinod
> 
> Changes in V1: (https://lkml.org/lkml/2018/11/23/485)
> 
> - Dropped OCFS2 changes per Joseph
> - Dropped media/video drivers changes per Hans
> 
> RFC - https://patchwork.kernel.org/patch/10678035/
> 
> Build tested this with multiple cross compiler options like alpha,
> sparc,
> arm64, x86, powerpc, powerpc64le etc with their default config which
> might
> not have compiled tested all driver related changes. I will
> appreciate
> folks giving this a test in their respective build environment.
> 
> All these places for replacement were found by running the following
> grep
> patterns on the entire kernel code. Please let me know if this might
> have
> missed some instances. This might also have replaced some false
> positives.
> I will appreciate suggestions, inputs and review.
> 
> 1. git grep "nid == -1"
> 2. git grep "node == -1"
> 3. git grep "nid = -1"
> 4. git grep "node = -1"
> 
>  arch/alpha/include/asm/topology.h             |  3 ++-
>  arch/ia64/kernel/numa.c                       |  2 +-
>  arch/ia64/mm/discontig.c                      |  6 +++---
>  arch/ia64/sn/kernel/io_common.c               |  3 ++-
>  arch/powerpc/include/asm/pci-bridge.h         |  3 ++-
>  arch/powerpc/kernel/paca.c                    |  3 ++-
>  arch/powerpc/kernel/pci-common.c              |  3 ++-
>  arch/powerpc/mm/numa.c                        | 14 +++++++-------
>  arch/powerpc/platforms/powernv/memtrace.c     |  5 +++--
>  arch/sparc/kernel/auxio_32.c                  |  3 ++-
>  arch/sparc/kernel/pci_fire.c                  |  3 ++-
>  arch/sparc/kernel/pci_schizo.c                |  3 ++-
>  arch/sparc/kernel/pcic.c                      |  7 ++++---
>  arch/sparc/kernel/psycho_common.c             |  3 ++-
>  arch/sparc/kernel/sbus.c                      |  3 ++-
>  arch/sparc/mm/init_64.c                       |  6 +++---
>  arch/sparc/prom/init_32.c                     |  3 ++-
>  arch/sparc/prom/init_64.c                     |  5 +++--
>  arch/sparc/prom/tree_32.c                     | 13 +++++++------
>  arch/sparc/prom/tree_64.c                     | 19 ++++++++++-------
> --
>  arch/x86/include/asm/pci.h                    |  3 ++-
>  arch/x86/kernel/apic/x2apic_uv_x.c            |  7 ++++---
>  arch/x86/kernel/smpboot.c                     |  3 ++-
>  arch/x86/platform/olpc/olpc_dt.c              | 17 +++++++++--------
>  drivers/block/mtip32xx/mtip32xx.c             |  5 +++--
>  drivers/dma/dmaengine.c                       |  4 +++-
>  drivers/infiniband/hw/hfi1/affinity.c         |  3 ++-
>  drivers/infiniband/hw/hfi1/init.c             |  3 ++-
>  drivers/iommu/dmar.c                          |  5 +++--
>  drivers/iommu/intel-iommu.c                   |  3 ++-
>  drivers/misc/sgi-xp/xpc_uv.c                  |  3 ++-
>  drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  5 +++--
>  include/linux/device.h                        |  2 +-
>  init/init_task.c                              |  3 ++-
>  kernel/kthread.c                              |  3 ++-
>  kernel/sched/fair.c                           | 15 ++++++++-------
>  lib/cpumask.c                                 |  3 ++-
>  mm/huge_memory.c                              | 13 +++++++------
>  mm/hugetlb.c                                  |  3 ++-
>  mm/ksm.c                                      |  2 +-
>  mm/memory.c                                   |  7 ++++---
>  mm/memory_hotplug.c                           | 12 ++++++------
>  mm/mempolicy.c                                |  2 +-
>  mm/page_alloc.c                               |  4 ++--
>  mm/page_ext.c                                 |  2 +-
>  net/core/pktgen.c                             |  3 ++-
>  net/qrtr/qrtr.c                               |  3 ++-
>  tools/perf/bench/numa.c                       |  6 +++---
>  48 files changed, 146 insertions(+), 108 deletions(-)

^ permalink raw reply

* [v6,3/7] dt-bindings: dmaengine: xilinx_dma: add optional xlnx,sg-length-width property
From: Rob Herring @ 2018-11-26 16:12 UTC (permalink / raw)
  To: Andrea Merello
  Cc: vkoul, dan.j.williams, michal.simek, appana.durga.rao, dmaengine,
	linux-arm-kernel, linux-kernel, mark.rutland, devicetree,
	radhey.shyam.pandey

On Tue, Nov 20, 2018 at 04:31:47PM +0100, Andrea Merello wrote:
> The width of the "length register" cannot be autodetected, and it is now
> specified with a DT property. Add documentation for it.
> 
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: devicetree@vger.kernel.org
> Cc: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
> Signed-off-by: Andrea Merello <andrea.merello@gmail.com>
> Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
> ---
> Changes in v2:
> 	- change property name
> 	- property is now optional
> 	- cc DT maintainer
> Changes in v3:
> 	- reword
> 	- cc DT maintainerS and ML
> Changes in v4:
> 	- specify the unit, the valid range and the default value
> Changes in v5:
> 	- commit message trivial fix
> 	- fix spaces before tab
> Changes in v6:
> 	None
> ---
>  Documentation/devicetree/bindings/dma/xilinx/xilinx_dma.txt | 4 ++++
>  1 file changed, 4 insertions(+)

Please add acks/reviewed-bys when posting new versions.

^ permalink raw reply

* dmaengine: zynqmp_dma: replace spin_lock_bh with spin_lock_irqsave
From: Michael Tretter @ 2018-11-26 15:14 UTC (permalink / raw)
  To: vkoul; +Cc: dmaengine, appana.durga.rao, kernel, Michael Tretter

All device_prep_dma_* functions and device_issue_pending can be called
from an interrupt context. As this includes hard IRQs, we must use
spin_lock_irqsave() instead of spin_lock_bh() to access chan->lock.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 drivers/dma/xilinx/zynqmp_dma.c | 37 ++++++++++++++++++++-------------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/drivers/dma/xilinx/zynqmp_dma.c b/drivers/dma/xilinx/zynqmp_dma.c
index c74a88b65039..6f26b59a7216 100644
--- a/drivers/dma/xilinx/zynqmp_dma.c
+++ b/drivers/dma/xilinx/zynqmp_dma.c
@@ -375,9 +375,10 @@ static dma_cookie_t zynqmp_dma_tx_submit(struct dma_async_tx_descriptor *tx)
 	struct zynqmp_dma_chan *chan = to_chan(tx->chan);
 	struct zynqmp_dma_desc_sw *desc, *new;
 	dma_cookie_t cookie;
+	unsigned long irqflags;
 
 	new = tx_to_desc(tx);
-	spin_lock_bh(&chan->lock);
+	spin_lock_irqsave(&chan->lock, irqflags);
 	cookie = dma_cookie_assign(tx);
 
 	if (!list_empty(&chan->pending_list)) {
@@ -393,7 +394,7 @@ static dma_cookie_t zynqmp_dma_tx_submit(struct dma_async_tx_descriptor *tx)
 	}
 
 	list_add_tail(&new->node, &chan->pending_list);
-	spin_unlock_bh(&chan->lock);
+	spin_unlock_irqrestore(&chan->lock, irqflags);
 
 	return cookie;
 }
@@ -408,12 +409,13 @@ static struct zynqmp_dma_desc_sw *
 zynqmp_dma_get_descriptor(struct zynqmp_dma_chan *chan)
 {
 	struct zynqmp_dma_desc_sw *desc;
+	unsigned long irqflags;
 
-	spin_lock_bh(&chan->lock);
+	spin_lock_irqsave(&chan->lock, irqflags);
 	desc = list_first_entry(&chan->free_list,
 				struct zynqmp_dma_desc_sw, node);
 	list_del(&desc->node);
-	spin_unlock_bh(&chan->lock);
+	spin_unlock_irqrestore(&chan->lock, irqflags);
 
 	INIT_LIST_HEAD(&desc->tx_list);
 	/* Clear the src and dst descriptor memory */
@@ -643,10 +645,11 @@ static void zynqmp_dma_complete_descriptor(struct zynqmp_dma_chan *chan)
 static void zynqmp_dma_issue_pending(struct dma_chan *dchan)
 {
 	struct zynqmp_dma_chan *chan = to_chan(dchan);
+	unsigned long irqflags;
 
-	spin_lock_bh(&chan->lock);
+	spin_lock_irqsave(&chan->lock, irqflags);
 	zynqmp_dma_start_transfer(chan);
-	spin_unlock_bh(&chan->lock);
+	spin_unlock_irqrestore(&chan->lock, irqflags);
 }
 
 /**
@@ -667,10 +670,11 @@ static void zynqmp_dma_free_descriptors(struct zynqmp_dma_chan *chan)
 static void zynqmp_dma_free_chan_resources(struct dma_chan *dchan)
 {
 	struct zynqmp_dma_chan *chan = to_chan(dchan);
+	unsigned long irqflags;
 
-	spin_lock_bh(&chan->lock);
+	spin_lock_irqsave(&chan->lock, irqflags);
 	zynqmp_dma_free_descriptors(chan);
-	spin_unlock_bh(&chan->lock);
+	spin_unlock_irqrestore(&chan->lock, irqflags);
 	dma_free_coherent(chan->dev,
 		(2 * ZYNQMP_DMA_DESC_SIZE(chan) * ZYNQMP_DMA_NUM_DESCS),
 		chan->desc_pool_v, chan->desc_pool_p);
@@ -743,8 +747,9 @@ static void zynqmp_dma_do_tasklet(unsigned long data)
 {
 	struct zynqmp_dma_chan *chan = (struct zynqmp_dma_chan *)data;
 	u32 count;
+	unsigned long irqflags;
 
-	spin_lock(&chan->lock);
+	spin_lock_irqsave(&chan->lock, irqflags);
 
 	if (chan->err) {
 		zynqmp_dma_reset(chan);
@@ -764,7 +769,7 @@ static void zynqmp_dma_do_tasklet(unsigned long data)
 		zynqmp_dma_start_transfer(chan);
 
 unlock:
-	spin_unlock(&chan->lock);
+	spin_unlock_irqrestore(&chan->lock, irqflags);
 }
 
 /**
@@ -776,11 +781,12 @@ static void zynqmp_dma_do_tasklet(unsigned long data)
 static int zynqmp_dma_device_terminate_all(struct dma_chan *dchan)
 {
 	struct zynqmp_dma_chan *chan = to_chan(dchan);
+	unsigned long irqflags;
 
-	spin_lock_bh(&chan->lock);
+	spin_lock_irqsave(&chan->lock, irqflags);
 	writel(ZYNQMP_DMA_IDS_DEFAULT_MASK, chan->regs + ZYNQMP_DMA_IDS);
 	zynqmp_dma_free_descriptors(chan);
-	spin_unlock_bh(&chan->lock);
+	spin_unlock_irqrestore(&chan->lock, irqflags);
 
 	return 0;
 }
@@ -804,19 +810,20 @@ static struct dma_async_tx_descriptor *zynqmp_dma_prep_memcpy(
 	void *desc = NULL, *prev = NULL;
 	size_t copy;
 	u32 desc_cnt;
+	unsigned long irqflags;
 
 	chan = to_chan(dchan);
 
 	desc_cnt = DIV_ROUND_UP(len, ZYNQMP_DMA_MAX_TRANS_LEN);
 
-	spin_lock_bh(&chan->lock);
+	spin_lock_irqsave(&chan->lock, irqflags);
 	if (desc_cnt > chan->desc_free_cnt) {
-		spin_unlock_bh(&chan->lock);
+		spin_unlock_irqrestore(&chan->lock, irqflags);
 		dev_dbg(chan->dev, "chan %p descs are not available\n", chan);
 		return NULL;
 	}
 	chan->desc_free_cnt = chan->desc_free_cnt - desc_cnt;
-	spin_unlock_bh(&chan->lock);
+	spin_unlock_irqrestore(&chan->lock, irqflags);
 
 	do {
 		/* Allocate and populate the descriptor */

^ permalink raw reply related

* [V2] mm: Replace all open encodings for NUMA_NO_NODE
From: Anshuman Khandual @ 2018-11-26 14:02 UTC (permalink / raw)
  To: David Hildenbrand, linux-mm, linux-kernel
  Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, intel-wired-lan,
	linux-media, iommu, linux-rdma, dmaengine, linux-block,
	sparclinux, linuxppc-dev, linux-ia64, linux-alpha, akpm,
	jiangqi903, hverkuil, vkoul

On 11/26/2018 06:18 PM, David Hildenbrand wrote:
> On 26.11.18 13:26, Anshuman Khandual wrote:
>> At present there are multiple places where invalid node number is encoded
>> as -1. Even though implicitly understood it is always better to have macros
>> in there. Replace these open encodings for an invalid node number with the
>> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
>> 'invalid node' from various places redirecting them to a common definition.
>>
>> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
>> ---
>> Changes in V2:
>>
>> - Added inclusion of 'numa.h' header at various places per Andrew
>> - Updated 'dev_to_node' to use NUMA_NO_NODE instead per Vinod
> 
> Reviewed-by: David Hildenbrand <david@redhat.com>

Thanks David. My bad, forgot to add your review tag from the earlier version.

^ permalink raw reply

* dma: cppi41: delete channel from pending list when stop channel
From: Bin Liu @ 2018-11-26 13:47 UTC (permalink / raw)
  To: Vinod Koul; +Cc: Peter Ujfalusi, dmaengine, linux-usb, stable

Hi,

On Sat, Nov 24, 2018 at 07:58:03PM +0530, Vinod Koul wrote:
> On 12-11-18, 09:43, Bin Liu wrote:
> > The driver defines three states for a cppi channel.
> > - idle: .chan_busy == 0 && not in .pending list
> > - pending: .chan_busy == 0 && in .pending list
> > - busy: .chan_busy == 1 && not in .pending list
> > 
> > There are cases in which the cppi channel could be in the pending state
> > when cppi41_dma_issue_pending() is called after cppi41_runtime_suspend()
> > is called.
> > 
> > cppi41_stop_chan() has a bug for these cases to set channels to idle state.
> > It only checks the .chan_busy flag, but not the .pending list, then later
> > when cppi41_runtime_resume() is called the channels in .pending list will
> > be transitioned to busy state.
> > 
> > Removing channels from the .pending list solves the problem.
> 
> I would like some testing, given that intent is to go to stable.
> Peter..?

FYI, this cppi41 dma driver is *only* used by musb controller driver. In
the past I received multiple reports for this issue, but I wasn't able
to reproduce it using similar test cases. The only way I could trigger
the issue is to do system suspend/resume test on AM335x with a USB hub
attached to the usb host port. This issue only happens once in the very
*first* time suspend/resume test after reboot.

Regards,
-Bin.

^ permalink raw reply

* [V2] mm: Replace all open encodings for NUMA_NO_NODE
From: David Hildenbrand @ 2018-11-26 12:48 UTC (permalink / raw)
  To: Anshuman Khandual, linux-mm, linux-kernel
  Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, intel-wired-lan,
	linux-media, iommu, linux-rdma, dmaengine, linux-block,
	sparclinux, linuxppc-dev, linux-ia64, linux-alpha, akpm,
	jiangqi903, hverkuil, vkoul

On 26.11.18 13:26, Anshuman Khandual wrote:
> At present there are multiple places where invalid node number is encoded
> as -1. Even though implicitly understood it is always better to have macros
> in there. Replace these open encodings for an invalid node number with the
> global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
> 'invalid node' from various places redirecting them to a common definition.
> 
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> Changes in V2:
> 
> - Added inclusion of 'numa.h' header at various places per Andrew
> - Updated 'dev_to_node' to use NUMA_NO_NODE instead per Vinod

Reviewed-by: David Hildenbrand <david@redhat.com>

^ permalink raw reply

* [V2] mm: Replace all open encodings for NUMA_NO_NODE
From: Anshuman Khandual @ 2018-11-26 12:26 UTC (permalink / raw)
  To: linux-mm, linux-kernel
  Cc: ocfs2-devel, linux-fbdev, dri-devel, netdev, intel-wired-lan,
	linux-media, iommu, linux-rdma, dmaengine, linux-block,
	sparclinux, linuxppc-dev, linux-ia64, linux-alpha, akpm,
	jiangqi903, hverkuil, vkoul

At present there are multiple places where invalid node number is encoded
as -1. Even though implicitly understood it is always better to have macros
in there. Replace these open encodings for an invalid node number with the
global macro NUMA_NO_NODE. This helps remove NUMA related assumptions like
'invalid node' from various places redirecting them to a common definition.

Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
Changes in V2:

- Added inclusion of 'numa.h' header at various places per Andrew
- Updated 'dev_to_node' to use NUMA_NO_NODE instead per Vinod

Changes in V1: (https://lkml.org/lkml/2018/11/23/485)

- Dropped OCFS2 changes per Joseph
- Dropped media/video drivers changes per Hans

RFC - https://patchwork.kernel.org/patch/10678035/

Build tested this with multiple cross compiler options like alpha, sparc,
arm64, x86, powerpc, powerpc64le etc with their default config which might
not have compiled tested all driver related changes. I will appreciate
folks giving this a test in their respective build environment.

All these places for replacement were found by running the following grep
patterns on the entire kernel code. Please let me know if this might have
missed some instances. This might also have replaced some false positives.
I will appreciate suggestions, inputs and review.

1. git grep "nid == -1"
2. git grep "node == -1"
3. git grep "nid = -1"
4. git grep "node = -1"

 arch/alpha/include/asm/topology.h             |  3 ++-
 arch/ia64/kernel/numa.c                       |  2 +-
 arch/ia64/mm/discontig.c                      |  6 +++---
 arch/ia64/sn/kernel/io_common.c               |  3 ++-
 arch/powerpc/include/asm/pci-bridge.h         |  3 ++-
 arch/powerpc/kernel/paca.c                    |  3 ++-
 arch/powerpc/kernel/pci-common.c              |  3 ++-
 arch/powerpc/mm/numa.c                        | 14 +++++++-------
 arch/powerpc/platforms/powernv/memtrace.c     |  5 +++--
 arch/sparc/kernel/auxio_32.c                  |  3 ++-
 arch/sparc/kernel/pci_fire.c                  |  3 ++-
 arch/sparc/kernel/pci_schizo.c                |  3 ++-
 arch/sparc/kernel/pcic.c                      |  7 ++++---
 arch/sparc/kernel/psycho_common.c             |  3 ++-
 arch/sparc/kernel/sbus.c                      |  3 ++-
 arch/sparc/mm/init_64.c                       |  6 +++---
 arch/sparc/prom/init_32.c                     |  3 ++-
 arch/sparc/prom/init_64.c                     |  5 +++--
 arch/sparc/prom/tree_32.c                     | 13 +++++++------
 arch/sparc/prom/tree_64.c                     | 19 ++++++++++---------
 arch/x86/include/asm/pci.h                    |  3 ++-
 arch/x86/kernel/apic/x2apic_uv_x.c            |  7 ++++---
 arch/x86/kernel/smpboot.c                     |  3 ++-
 arch/x86/platform/olpc/olpc_dt.c              | 17 +++++++++--------
 drivers/block/mtip32xx/mtip32xx.c             |  5 +++--
 drivers/dma/dmaengine.c                       |  4 +++-
 drivers/infiniband/hw/hfi1/affinity.c         |  3 ++-
 drivers/infiniband/hw/hfi1/init.c             |  3 ++-
 drivers/iommu/dmar.c                          |  5 +++--
 drivers/iommu/intel-iommu.c                   |  3 ++-
 drivers/misc/sgi-xp/xpc_uv.c                  |  3 ++-
 drivers/net/ethernet/intel/ixgbe/ixgbe_main.c |  5 +++--
 include/linux/device.h                        |  2 +-
 init/init_task.c                              |  3 ++-
 kernel/kthread.c                              |  3 ++-
 kernel/sched/fair.c                           | 15 ++++++++-------
 lib/cpumask.c                                 |  3 ++-
 mm/huge_memory.c                              | 13 +++++++------
 mm/hugetlb.c                                  |  3 ++-
 mm/ksm.c                                      |  2 +-
 mm/memory.c                                   |  7 ++++---
 mm/memory_hotplug.c                           | 12 ++++++------
 mm/mempolicy.c                                |  2 +-
 mm/page_alloc.c                               |  4 ++--
 mm/page_ext.c                                 |  2 +-
 net/core/pktgen.c                             |  3 ++-
 net/qrtr/qrtr.c                               |  3 ++-
 tools/perf/bench/numa.c                       |  6 +++---
 48 files changed, 146 insertions(+), 108 deletions(-)

diff --git a/arch/alpha/include/asm/topology.h b/arch/alpha/include/asm/topology.h
index e6e13a8..5a77a40 100644
--- a/arch/alpha/include/asm/topology.h
+++ b/arch/alpha/include/asm/topology.h
@@ -4,6 +4,7 @@
 
 #include <linux/smp.h>
 #include <linux/threads.h>
+#include <linux/numa.h>
 #include <asm/machvec.h>
 
 #ifdef CONFIG_NUMA
@@ -29,7 +30,7 @@ static const struct cpumask *cpumask_of_node(int node)
 {
 	int cpu;
 
-	if (node == -1)
+	if (node == NUMA_NO_NODE)
 		return cpu_all_mask;
 
 	cpumask_clear(&node_to_cpumask_map[node]);
diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c
index 92c3762..1315da6 100644
--- a/arch/ia64/kernel/numa.c
+++ b/arch/ia64/kernel/numa.c
@@ -74,7 +74,7 @@ void __init build_cpu_to_node_map(void)
 		cpumask_clear(&node_to_cpu_mask[node]);
 
 	for_each_possible_early_cpu(cpu) {
-		node = -1;
+		node = NUMA_NO_NODE;
 		for (i = 0; i < NR_CPUS; ++i)
 			if (cpu_physical_id(cpu) == node_cpuid[i].phys_id) {
 				node = node_cpuid[i].nid;
diff --git a/arch/ia64/mm/discontig.c b/arch/ia64/mm/discontig.c
index 8a96578..f9c3675 100644
--- a/arch/ia64/mm/discontig.c
+++ b/arch/ia64/mm/discontig.c
@@ -227,7 +227,7 @@ void __init setup_per_cpu_areas(void)
 	 * CPUs are put into groups according to node.  Walk cpu_map
 	 * and create new groups at node boundaries.
 	 */
-	prev_node = -1;
+	prev_node = NUMA_NO_NODE;
 	ai->nr_groups = 0;
 	for (unit = 0; unit < nr_units; unit++) {
 		cpu = cpu_map[unit];
@@ -435,7 +435,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
 {
 	void *ptr = NULL;
 	u8 best = 0xff;
-	int bestnode = -1, node, anynode = 0;
+	int bestnode = NUMA_NO_NODE, node, anynode = 0;
 
 	for_each_online_node(node) {
 		if (node_isset(node, memory_less_mask))
@@ -447,7 +447,7 @@ static void __init *memory_less_node_alloc(int nid, unsigned long pernodesize)
 		anynode = node;
 	}
 
-	if (bestnode == -1)
+	if (bestnode == NUMA_NO_NODE)
 		bestnode = anynode;
 
 	ptr = memblock_alloc_try_nid(pernodesize, PERCPU_PAGE_SIZE,
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
index 8df13d0..221ede3 100644
--- a/arch/ia64/sn/kernel/io_common.c
+++ b/arch/ia64/sn/kernel/io_common.c
@@ -9,6 +9,7 @@
 #include <linux/memblock.h>
 #include <linux/export.h>
 #include <linux/slab.h>
+#include <linux/numa.h>
 #include <asm/sn/types.h>
 #include <asm/sn/addrs.h>
 #include <asm/sn/sn_feature_sets.h>
@@ -344,7 +345,7 @@ sn_common_bus_fixup(struct pci_bus *bus,
 		printk(KERN_WARNING "on node %d but only %d nodes online."
 		       "Association set to undetermined.\n",
 		       controller->node, num_online_nodes());
-		controller->node = -1;
+		controller->node = NUMA_NO_NODE;
 	}
 }
 
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 94d4490..97bf4b1 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -10,6 +10,7 @@
 #include <linux/pci.h>
 #include <linux/list.h>
 #include <linux/ioport.h>
+#include <linux/numa.h>
 
 struct device_node;
 
@@ -264,7 +265,7 @@ extern int pcibios_map_io_space(struct pci_bus *bus);
 #ifdef CONFIG_NUMA
 #define PHB_SET_NODE(PHB, NODE)		((PHB)->node = (NODE))
 #else
-#define PHB_SET_NODE(PHB, NODE)		((PHB)->node = -1)
+#define PHB_SET_NODE(PHB, NODE)		((PHB)->node = NUMA_NO_NODE)
 #endif
 
 #endif	/* CONFIG_PPC64 */
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 913bfca..b848012 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -11,6 +11,7 @@
 #include <linux/export.h>
 #include <linux/memblock.h>
 #include <linux/sched/task.h>
+#include <linux/numa.h>
 
 #include <asm/lppaca.h>
 #include <asm/paca.h>
@@ -36,7 +37,7 @@ static void *__init alloc_paca_data(unsigned long size, unsigned long align,
 	 * which will put its paca in the right place.
 	 */
 	if (cpu == boot_cpuid) {
-		nid = -1;
+		nid = NUMA_NO_NODE;
 		memblock_set_bottom_up(true);
 	} else {
 		nid = early_cpu_to_node(cpu);
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 88e4f69..4538e8d 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -32,6 +32,7 @@
 #include <linux/vmalloc.h>
 #include <linux/slab.h>
 #include <linux/vgaarb.h>
+#include <linux/numa.h>
 
 #include <asm/processor.h>
 #include <asm/io.h>
@@ -132,7 +133,7 @@ struct pci_controller *pcibios_alloc_controller(struct device_node *dev)
 		int nid = of_node_to_nid(dev);
 
 		if (nid < 0 || !node_online(nid))
-			nid = -1;
+			nid = NUMA_NO_NODE;
 
 		PHB_SET_NODE(phb, nid);
 	}
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index ce28ae5..84ad8c9 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -215,7 +215,7 @@ static void initialize_distance_lookup_table(int nid,
  */
 static int associativity_to_nid(const __be32 *associativity)
 {
-	int nid = -1;
+	int nid = NUMA_NO_NODE;
 
 	if (min_common_depth == -1)
 		goto out;
@@ -225,7 +225,7 @@ static int associativity_to_nid(const __be32 *associativity)
 
 	/* POWER4 LPAR uses 0xffff as invalid node */
 	if (nid == 0xffff || nid >= MAX_NUMNODES)
-		nid = -1;
+		nid = NUMA_NO_NODE;
 
 	if (nid > 0 &&
 		of_read_number(associativity, 1) >= distance_ref_points_depth) {
@@ -244,7 +244,7 @@ static int associativity_to_nid(const __be32 *associativity)
  */
 static int of_node_to_nid_single(struct device_node *device)
 {
-	int nid = -1;
+	int nid = NUMA_NO_NODE;
 	const __be32 *tmp;
 
 	tmp = of_get_associativity(device);
@@ -256,7 +256,7 @@ static int of_node_to_nid_single(struct device_node *device)
 /* Walk the device tree upwards, looking for an associativity id */
 int of_node_to_nid(struct device_node *device)
 {
-	int nid = -1;
+	int nid = NUMA_NO_NODE;
 
 	of_node_get(device);
 	while (device) {
@@ -454,7 +454,7 @@ static int of_drconf_to_nid_single(struct drmem_lmb *lmb)
  */
 static int numa_setup_cpu(unsigned long lcpu)
 {
-	int nid = -1;
+	int nid = NUMA_NO_NODE;
 	struct device_node *cpu;
 
 	/*
@@ -930,7 +930,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
 {
 	struct drmem_lmb *lmb;
 	unsigned long lmb_size;
-	int nid = -1;
+	int nid = NUMA_NO_NODE;
 
 	lmb_size = drmem_lmb_size();
 
@@ -960,7 +960,7 @@ static int hot_add_drconf_scn_to_nid(unsigned long scn_addr)
 static int hot_add_node_scn_to_nid(unsigned long scn_addr)
 {
 	struct device_node *memory;
-	int nid = -1;
+	int nid = NUMA_NO_NODE;
 
 	for_each_node_by_type(memory, "memory") {
 		unsigned long start, size;
diff --git a/arch/powerpc/platforms/powernv/memtrace.c b/arch/powerpc/platforms/powernv/memtrace.c
index 84d038e..248a38a 100644
--- a/arch/powerpc/platforms/powernv/memtrace.c
+++ b/arch/powerpc/platforms/powernv/memtrace.c
@@ -20,6 +20,7 @@
 #include <linux/slab.h>
 #include <linux/memory.h>
 #include <linux/memory_hotplug.h>
+#include <linux/numa.h>
 #include <asm/machdep.h>
 #include <asm/debugfs.h>
 
@@ -223,7 +224,7 @@ static int memtrace_online(void)
 		ent = &memtrace_array[i];
 
 		/* We have onlined this chunk previously */
-		if (ent->nid == -1)
+		if (ent->nid == NUMA_NO_NODE)
 			continue;
 
 		/* Remove from io mappings */
@@ -257,7 +258,7 @@ static int memtrace_online(void)
 		 */
 		debugfs_remove_recursive(ent->dir);
 		pr_info("Added trace memory back to node %d\n", ent->nid);
-		ent->size = ent->start = ent->nid = -1;
+		ent->size = ent->start = ent->nid = NUMA_NO_NODE;
 	}
 	if (ret)
 		return ret;
diff --git a/arch/sparc/kernel/auxio_32.c b/arch/sparc/kernel/auxio_32.c
index a32d588..276b4ec 100644
--- a/arch/sparc/kernel/auxio_32.c
+++ b/arch/sparc/kernel/auxio_32.c
@@ -10,6 +10,7 @@
 #include <linux/of.h>
 #include <linux/of_device.h>
 #include <linux/export.h>
+#include <linux/numa.h>
 
 #include <asm/oplib.h>
 #include <asm/io.h>
@@ -120,7 +121,7 @@ void __init auxio_power_probe(void)
 	node = prom_searchsiblings(node, "obio");
 	node = prom_getchild(node);
 	node = prom_searchsiblings(node, "power");
-	if (node == 0 || (s32)node == -1)
+	if (node == 0 || (s32)node == NUMA_NO_NODE)
 		return;
 
 	/* Map the power control register. */
diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index be71ae0..0ca08d4 100644
--- a/arch/sparc/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
@@ -11,6 +11,7 @@
 #include <linux/export.h>
 #include <linux/irq.h>
 #include <linux/of_device.h>
+#include <linux/numa.h>
 
 #include <asm/prom.h>
 #include <asm/irq.h>
@@ -416,7 +417,7 @@ static int pci_fire_pbm_init(struct pci_pbm_info *pbm,
 	struct device_node *dp = op->dev.of_node;
 	int err;
 
-	pbm->numa_node = -1;
+	pbm->numa_node = NUMA_NO_NODE;
 
 	pbm->pci_ops = &sun4u_pci_ops;
 	pbm->config_space_reg_bits = 12;
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 934b97c..421aba0 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -12,6 +12,7 @@
 #include <linux/export.h>
 #include <linux/interrupt.h>
 #include <linux/of_device.h>
+#include <linux/numa.h>
 
 #include <asm/iommu.h>
 #include <asm/irq.h>
@@ -1347,7 +1348,7 @@ static int schizo_pbm_init(struct pci_pbm_info *pbm,
 	pbm->next = pci_pbm_root;
 	pci_pbm_root = pbm;
 
-	pbm->numa_node = -1;
+	pbm->numa_node = NUMA_NO_NODE;
 
 	pbm->pci_ops = &sun4u_pci_ops;
 	pbm->config_space_reg_bits = 8;
diff --git a/arch/sparc/kernel/pcic.c b/arch/sparc/kernel/pcic.c
index ee4c9a9..190f934 100644
--- a/arch/sparc/kernel/pcic.c
+++ b/arch/sparc/kernel/pcic.c
@@ -17,6 +17,7 @@
 #include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/jiffies.h>
+#include <linux/numa.h>
 
 #include <asm/swift.h> /* for cache flushing. */
 #include <asm/io.h>
@@ -476,7 +477,7 @@ static void pcic_map_pci_device(struct linux_pcic *pcic,
 	unsigned long flags;
 	int j;
 
-	if (node == 0 || node == -1) {
+	if (node == 0 || node == NUMA_NO_NODE) {
 		strcpy(namebuf, "???");
 	} else {
 		prom_getstring(node, "name", namebuf, 63); namebuf[63] = 0;
@@ -535,7 +536,7 @@ pcic_fill_irq(struct linux_pcic *pcic, struct pci_dev *dev, int node)
 	int i, ivec;
 	char namebuf[64];
 
-	if (node == 0 || node == -1) {
+	if (node == 0 || node == NUMA_NO_NODE) {
 		strcpy(namebuf, "???");
 	} else {
 		prom_getstring(node, "name", namebuf, sizeof(namebuf));
@@ -625,7 +626,7 @@ void pcibios_fixup_bus(struct pci_bus *bus)
 	list_for_each_entry(dev, &bus->devices, bus_list) {
 		node = pdev_to_pnode(&pcic->pbm, dev);
 		if(node == 0)
-			node = -1;
+			node = NUMA_NO_NODE;
 
 		/* cookies */
 		pcp = pci_devcookie_alloc();
diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
index 81aa91e..e90bcb6 100644
--- a/arch/sparc/kernel/psycho_common.c
+++ b/arch/sparc/kernel/psycho_common.c
@@ -5,6 +5,7 @@
  */
 #include <linux/kernel.h>
 #include <linux/interrupt.h>
+#include <linux/numa.h>
 
 #include <asm/upa.h>
 
@@ -454,7 +455,7 @@ void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct platform_device *op
 	struct device_node *dp = op->dev.of_node;
 
 	pbm->name = dp->full_name;
-	pbm->numa_node = -1;
+	pbm->numa_node = NUMA_NO_NODE;
 	pbm->chip_type = chip_type;
 	pbm->chip_version = of_getintprop_default(dp, "version#", 0);
 	pbm->chip_revision = of_getintprop_default(dp, "module-revision#", 0);
diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c
index c133dfc..e6fd924 100644
--- a/arch/sparc/kernel/sbus.c
+++ b/arch/sparc/kernel/sbus.c
@@ -15,6 +15,7 @@
 #include <linux/interrupt.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+#include <linux/numa.h>
 
 #include <asm/page.h>
 #include <asm/io.h>
@@ -561,7 +562,7 @@ static void __init sbus_iommu_init(struct platform_device *op)
 
 	op->dev.archdata.iommu = iommu;
 	op->dev.archdata.stc = strbuf;
-	op->dev.archdata.numa_node = -1;
+	op->dev.archdata.numa_node = NUMA_NO_NODE;
 
 	reg_base = regs + SYSIO_IOMMUREG_BASE;
 	iommu->iommu_control = reg_base + IOMMU_CONTROL;
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 3c8aac2..cb1bed1 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -976,13 +976,13 @@ static u64 __init memblock_nid_range_sun4u(u64 start, u64 end, int *nid)
 {
 	int prev_nid, new_nid;
 
-	prev_nid = -1;
+	prev_nid = NUMA_NO_NODE;
 	for ( ; start < end; start += PAGE_SIZE) {
 		for (new_nid = 0; new_nid < num_node_masks; new_nid++) {
 			struct node_mem_mask *p = &node_masks[new_nid];
 
 			if ((start & p->mask) == p->match) {
-				if (prev_nid == -1)
+				if (prev_nid == NUMA_NO_NODE)
 					prev_nid = new_nid;
 				break;
 			}
@@ -1208,7 +1208,7 @@ int of_node_to_nid(struct device_node *dp)
 	md = mdesc_grab();
 
 	count = 0;
-	nid = -1;
+	nid = NUMA_NO_NODE;
 	mdesc_for_each_node_by_name(md, grp, "group") {
 		if (!scan_arcs_for_cfg_handle(md, grp, cfg_handle)) {
 			nid = count;
diff --git a/arch/sparc/prom/init_32.c b/arch/sparc/prom/init_32.c
index d204701..7c0750a 100644
--- a/arch/sparc/prom/init_32.c
+++ b/arch/sparc/prom/init_32.c
@@ -10,6 +10,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/module.h>
+#include <linux/numa.h>
 
 #include <asm/openprom.h>
 #include <asm/oplib.h>
@@ -58,7 +59,7 @@ void __init prom_init(struct linux_romvec *rp)
 	prom_nodeops = romvec->pv_nodeops;
 
 	prom_root_node = prom_getsibling(0);
-	if ((prom_root_node == 0) || ((s32)prom_root_node == -1))
+	if ((prom_root_node == 0) || ((s32)prom_root_node == NUMA_NO_NODE))
 		prom_halt();
 
 	if((((unsigned long) prom_nodeops) == 0) || 
diff --git a/arch/sparc/prom/init_64.c b/arch/sparc/prom/init_64.c
index 103aa91..196133d 100644
--- a/arch/sparc/prom/init_64.c
+++ b/arch/sparc/prom/init_64.c
@@ -11,6 +11,7 @@
 #include <linux/init.h>
 #include <linux/string.h>
 #include <linux/ctype.h>
+#include <linux/numa.h>
 
 #include <asm/openprom.h>
 #include <asm/oplib.h>
@@ -36,13 +37,13 @@ void __init prom_init(void *cif_handler)
 	prom_cif_init(cif_handler);
 
 	prom_chosen_node = prom_finddevice(prom_chosen_path);
-	if (!prom_chosen_node || (s32)prom_chosen_node == -1)
+	if (!prom_chosen_node || (s32)prom_chosen_node == NUMA_NO_NODE)
 		prom_halt();
 
 	prom_stdout = prom_getint(prom_chosen_node, "stdout");
 
 	node = prom_finddevice("/openprom");
-	if (!node || (s32)node == -1)
+	if (!node || (s32)node == NUMA_NO_NODE)
 		prom_halt();
 
 	prom_getstring(node, "version", prom_version, sizeof(prom_version));
diff --git a/arch/sparc/prom/tree_32.c b/arch/sparc/prom/tree_32.c
index 0fed893..36b9be5 100644
--- a/arch/sparc/prom/tree_32.c
+++ b/arch/sparc/prom/tree_32.c
@@ -12,6 +12,7 @@
 #include <linux/sched.h>
 #include <linux/ctype.h>
 #include <linux/module.h>
+#include <linux/numa.h>
 
 #include <asm/openprom.h>
 #include <asm/oplib.h>
@@ -41,11 +42,11 @@ phandle prom_getchild(phandle node)
 {
 	phandle cnode;
 
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return 0;
 
 	cnode = __prom_getchild(node);
-	if (cnode == 0 || (s32)cnode == -1)
+	if (cnode == 0 || (s32)cnode == NUMA_NO_NODE)
 		return 0;
 
 	return cnode;
@@ -73,11 +74,11 @@ phandle prom_getsibling(phandle node)
 {
 	phandle sibnode;
 
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return 0;
 
 	sibnode = __prom_getsibling(node);
-	if (sibnode == 0 || (s32)sibnode == -1)
+	if (sibnode == 0 || (s32)sibnode == NUMA_NO_NODE)
 		return 0;
 
 	return sibnode;
@@ -220,7 +221,7 @@ static char *__prom_nextprop(phandle node, char * oprop)
  */
 char *prom_nextprop(phandle node, char *oprop, char *buffer)
 {
-	if (node == 0 || (s32)node == -1)
+	if (node == 0 || (s32)node == NUMA_NO_NODE)
 		return "";
 
 	return __prom_nextprop(node, oprop);
@@ -304,7 +305,7 @@ phandle prom_inst2pkg(int inst)
 	node = (*romvec->pv_v2devops.v2_inst2pkg)(inst);
 	restore_current();
 	spin_unlock_irqrestore(&prom_lock, flags);
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return 0;
 	return node;
 }
diff --git a/arch/sparc/prom/tree_64.c b/arch/sparc/prom/tree_64.c
index 989e799..4634620 100644
--- a/arch/sparc/prom/tree_64.c
+++ b/arch/sparc/prom/tree_64.c
@@ -12,6 +12,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/module.h>
+#include <linux/numa.h>
 
 #include <asm/openprom.h>
 #include <asm/oplib.h>
@@ -44,10 +45,10 @@ phandle prom_getchild(phandle node)
 {
 	phandle cnode;
 
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return 0;
 	cnode = __prom_getchild(node);
-	if ((s32)cnode == -1)
+	if ((s32)cnode == NUMA_NO_NODE)
 		return 0;
 	return cnode;
 }
@@ -57,10 +58,10 @@ inline phandle prom_getparent(phandle node)
 {
 	phandle cnode;
 
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return 0;
 	cnode = prom_node_to_node("parent", node);
-	if ((s32)cnode == -1)
+	if ((s32)cnode == NUMA_NO_NODE)
 		return 0;
 	return cnode;
 }
@@ -77,10 +78,10 @@ phandle prom_getsibling(phandle node)
 {
 	phandle sibnode;
 
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return 0;
 	sibnode = __prom_getsibling(node);
-	if ((s32)sibnode == -1)
+	if ((s32)sibnode == NUMA_NO_NODE)
 		return 0;
 
 	return sibnode;
@@ -241,7 +242,7 @@ char *prom_firstprop(phandle node, char *buffer)
 	unsigned long args[7];
 
 	*buffer = 0;
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return buffer;
 
 	args[0] = (unsigned long) prom_nextprop_name;
@@ -267,7 +268,7 @@ char *prom_nextprop(phandle node, const char *oprop, char *buffer)
 	unsigned long args[7];
 	char buf[32];
 
-	if ((s32)node == -1) {
+	if ((s32)node == NUMA_NO_NODE) {
 		*buffer = 0;
 		return buffer;
 	}
@@ -370,7 +371,7 @@ inline phandle prom_inst2pkg(int inst)
 	p1275_cmd_direct(args);
 
 	node = (int) args[4];
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return 0;
 	return node;
 }
diff --git a/arch/x86/include/asm/pci.h b/arch/x86/include/asm/pci.h
index 6629636..e662f98 100644
--- a/arch/x86/include/asm/pci.h
+++ b/arch/x86/include/asm/pci.h
@@ -7,6 +7,7 @@
 #include <linux/slab.h>
 #include <linux/string.h>
 #include <linux/scatterlist.h>
+#include <linux/numa.h>
 #include <asm/io.h>
 #include <asm/pat.h>
 #include <asm/x86_init.h>
@@ -141,7 +142,7 @@ cpumask_of_pcibus(const struct pci_bus *bus)
 	int node;
 
 	node = __pcibus_to_node(bus);
-	return (node == -1) ? cpu_online_mask :
+	return (node == NUMA_NO_NODE) ? cpu_online_mask :
 			      cpumask_of_node(node);
 }
 #endif
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 391f358..1ff658f 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -27,6 +27,7 @@
 #include <linux/crash_dump.h>
 #include <linux/reboot.h>
 #include <linux/memory.h>
+#include <linux/numa.h>
 
 #include <asm/uv/uv_mmrs.h>
 #include <asm/uv/uv_hub.h>
@@ -1390,7 +1391,7 @@ static void __init build_socket_tables(void)
 	}
 
 	/* Set socket -> node values: */
-	lnid = -1;
+	lnid = NUMA_NO_NODE;
 	for_each_present_cpu(cpu) {
 		int nid = cpu_to_node(cpu);
 		int apicid, sockid;
@@ -1521,7 +1522,7 @@ static void __init uv_system_init_hub(void)
 			new_hub->pnode = 0xffff;
 
 		new_hub->numa_blade_id = uv_node_to_blade_id(nodeid);
-		new_hub->memory_nid = -1;
+		new_hub->memory_nid = NUMA_NO_NODE;
 		new_hub->nr_possible_cpus = 0;
 		new_hub->nr_online_cpus = 0;
 	}
@@ -1538,7 +1539,7 @@ static void __init uv_system_init_hub(void)
 
 		uv_cpu_info_per(cpu)->p_uv_hub_info = uv_hub_info_list(nodeid);
 		uv_cpu_info_per(cpu)->blade_cpu_id = uv_cpu_hub_info(cpu)->nr_possible_cpus++;
-		if (uv_cpu_hub_info(cpu)->memory_nid == -1)
+		if (uv_cpu_hub_info(cpu)->memory_nid == NUMA_NO_NODE)
 			uv_cpu_hub_info(cpu)->memory_nid = cpu_to_node(cpu);
 
 		/* Init memoryless node: */
diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
index a9134d1..0e1ff8f 100644
--- a/arch/x86/kernel/smpboot.c
+++ b/arch/x86/kernel/smpboot.c
@@ -56,6 +56,7 @@
 #include <linux/stackprotector.h>
 #include <linux/gfp.h>
 #include <linux/cpuidle.h>
+#include <linux/numa.h>
 
 #include <asm/acpi.h>
 #include <asm/desc.h>
@@ -841,7 +842,7 @@ wakeup_secondary_cpu_via_init(int phys_apicid, unsigned long start_eip)
 /* reduce the number of lines printed when booting a large cpu count system */
 static void announce_cpu(int cpu, int apicid)
 {
-	static int current_node = -1;
+	static int current_node = NUMA_NO_NODE;
 	int node = early_cpu_to_node(cpu);
 	static int width, node_width;
 
diff --git a/arch/x86/platform/olpc/olpc_dt.c b/arch/x86/platform/olpc/olpc_dt.c
index 24d2175..7976ec2 100644
--- a/arch/x86/platform/olpc/olpc_dt.c
+++ b/arch/x86/platform/olpc/olpc_dt.c
@@ -21,6 +21,7 @@
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/of_pdt.h>
+#include <linux/numa.h>
 #include <asm/olpc.h>
 #include <asm/olpc_ofw.h>
 
@@ -29,10 +30,10 @@ static phandle __init olpc_dt_getsibling(phandle node)
 	const void *args[] = { (void *)node };
 	void *res[] = { &node };
 
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return 0;
 
-	if (olpc_ofw("peer", args, res) || (s32)node == -1)
+	if (olpc_ofw("peer", args, res) || (s32)node == NUMA_NO_NODE)
 		return 0;
 
 	return node;
@@ -43,10 +44,10 @@ static phandle __init olpc_dt_getchild(phandle node)
 	const void *args[] = { (void *)node };
 	void *res[] = { &node };
 
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return 0;
 
-	if (olpc_ofw("child", args, res) || (s32)node == -1) {
+	if (olpc_ofw("child", args, res) || (s32)node == NUMA_NO_NODE) {
 		pr_err("PROM: %s: fetching child failed!\n", __func__);
 		return 0;
 	}
@@ -60,7 +61,7 @@ static int __init olpc_dt_getproplen(phandle node, const char *prop)
 	int len;
 	void *res[] = { &len };
 
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return -1;
 
 	if (olpc_ofw("getproplen", args, res)) {
@@ -100,7 +101,7 @@ static int __init olpc_dt_nextprop(phandle node, char *prev, char *buf)
 
 	buf[0] = '\0';
 
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return -1;
 
 	if (olpc_ofw("nextprop", args, res) || success != 1)
@@ -115,7 +116,7 @@ static int __init olpc_dt_pkg2path(phandle node, char *buf,
 	const void *args[] = { (void *)node, buf, (void *)buflen };
 	void *res[] = { len };
 
-	if ((s32)node == -1)
+	if ((s32)node == NUMA_NO_NODE)
 		return -1;
 
 	if (olpc_ofw("package-to-path", args, res) || *len < 1)
@@ -176,7 +177,7 @@ static phandle __init olpc_dt_finddevice(const char *path)
 		return 0;
 	}
 
-	if ((s32) node == -1)
+	if ((s32) node == NUMA_NO_NODE)
 		return 0;
 
 	return node;
diff --git a/drivers/block/mtip32xx/mtip32xx.c b/drivers/block/mtip32xx/mtip32xx.c
index a7daa8a..bbe3871 100644
--- a/drivers/block/mtip32xx/mtip32xx.c
+++ b/drivers/block/mtip32xx/mtip32xx.c
@@ -40,6 +40,7 @@
 #include <linux/export.h>
 #include <linux/debugfs.h>
 #include <linux/prefetch.h>
+#include <linux/numa.h>
 #include "mtip32xx.h"
 
 #define HW_CMD_SLOT_SZ		(MTIP_MAX_COMMAND_SLOTS * 32)
@@ -4084,9 +4085,9 @@ static int get_least_used_cpu_on_node(int node)
 /* Helper for selecting a node in round robin mode */
 static inline int mtip_get_next_rr_node(void)
 {
-	static int next_node = -1;
+	static int next_node = NUMA_NO_NODE;
 
-	if (next_node == -1) {
+	if (next_node == NUMA_NO_NODE) {
 		next_node = first_online_node;
 		return next_node;
 	}
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index f1a441ab..3a11b10 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -63,6 +63,7 @@
 #include <linux/acpi_dma.h>
 #include <linux/of_dma.h>
 #include <linux/mempool.h>
+#include <linux/numa.h>
 
 static DEFINE_MUTEX(dma_list_mutex);
 static DEFINE_IDA(dma_ida);
@@ -386,7 +387,8 @@ EXPORT_SYMBOL(dma_issue_pending_all);
 static bool dma_chan_is_local(struct dma_chan *chan, int cpu)
 {
 	int node = dev_to_node(chan->device->dev);
-	return node == -1 || cpumask_test_cpu(cpu, cpumask_of_node(node));
+	return node == NUMA_NO_NODE ||
+		cpumask_test_cpu(cpu, cpumask_of_node(node));
 }
 
 /**
diff --git a/drivers/infiniband/hw/hfi1/affinity.c b/drivers/infiniband/hw/hfi1/affinity.c
index 2baf38c..4fe662c 100644
--- a/drivers/infiniband/hw/hfi1/affinity.c
+++ b/drivers/infiniband/hw/hfi1/affinity.c
@@ -48,6 +48,7 @@
 #include <linux/cpumask.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
+#include <linux/numa.h>
 
 #include "hfi.h"
 #include "affinity.h"
@@ -777,7 +778,7 @@ void hfi1_dev_affinity_clean_up(struct hfi1_devdata *dd)
 	_dev_comp_vect_cpu_mask_clean_up(dd, entry);
 unlock:
 	mutex_unlock(&node_affinity.lock);
-	dd->node = -1;
+	dd->node = NUMA_NO_NODE;
 }
 
 /*
diff --git a/drivers/infiniband/hw/hfi1/init.c b/drivers/infiniband/hw/hfi1/init.c
index 0904490..c25c402 100644
--- a/drivers/infiniband/hw/hfi1/init.c
+++ b/drivers/infiniband/hw/hfi1/init.c
@@ -54,6 +54,7 @@
 #include <linux/printk.h>
 #include <linux/hrtimer.h>
 #include <linux/bitmap.h>
+#include <linux/numa.h>
 #include <rdma/rdma_vt.h>
 
 #include "hfi.h"
@@ -1303,7 +1304,7 @@ static struct hfi1_devdata *hfi1_alloc_devdata(struct pci_dev *pdev,
 		dd->unit = ret;
 		list_add(&dd->list, &hfi1_dev_list);
 	}
-	dd->node = -1;
+	dd->node = NUMA_NO_NODE;
 
 	spin_unlock_irqrestore(&hfi1_devs_lock, flags);
 	idr_preload_end();
diff --git a/drivers/iommu/dmar.c b/drivers/iommu/dmar.c
index d9c748b..01b967a 100644
--- a/drivers/iommu/dmar.c
+++ b/drivers/iommu/dmar.c
@@ -39,6 +39,7 @@
 #include <linux/dmi.h>
 #include <linux/slab.h>
 #include <linux/iommu.h>
+#include <linux/numa.h>
 #include <asm/irq_remapping.h>
 #include <asm/iommu_table.h>
 
@@ -477,7 +478,7 @@ static int dmar_parse_one_rhsa(struct acpi_dmar_header *header, void *arg)
 			int node = acpi_map_pxm_to_node(rhsa->proximity_domain);
 
 			if (!node_online(node))
-				node = -1;
+				node = NUMA_NO_NODE;
 			drhd->iommu->node = node;
 			return 0;
 		}
@@ -1062,7 +1063,7 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)
 	iommu->msagaw = msagaw;
 	iommu->segment = drhd->segment;
 
-	iommu->node = -1;
+	iommu->node = NUMA_NO_NODE;
 
 	ver = readl(iommu->reg + DMAR_VER_REG);
 	pr_info("%s: reg_base_addr %llx ver %d:%d cap %llx ecap %llx\n",
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c
index 41a4b88..9ca9794 100644
--- a/drivers/iommu/intel-iommu.c
+++ b/drivers/iommu/intel-iommu.c
@@ -47,6 +47,7 @@
 #include <linux/dma-contiguous.h>
 #include <linux/dma-direct.h>
 #include <linux/crash_dump.h>
+#include <linux/numa.h>
 #include <asm/irq_remapping.h>
 #include <asm/cacheflush.h>
 #include <asm/iommu.h>
@@ -1772,7 +1773,7 @@ static struct dmar_domain *alloc_domain(int flags)
 		return NULL;
 
 	memset(domain, 0, sizeof(*domain));
-	domain->nid = -1;
+	domain->nid = NUMA_NO_NODE;
 	domain->flags = flags;
 	domain->has_iotlb_device = false;
 	INIT_LIST_HEAD(&domain->devices);
diff --git a/drivers/misc/sgi-xp/xpc_uv.c b/drivers/misc/sgi-xp/xpc_uv.c
index 0441abe..9e443df 100644
--- a/drivers/misc/sgi-xp/xpc_uv.c
+++ b/drivers/misc/sgi-xp/xpc_uv.c
@@ -22,6 +22,7 @@
 #include <linux/module.h>
 #include <linux/err.h>
 #include <linux/slab.h>
+#include <linux/numa.h>
 #include <asm/uv/uv_hub.h>
 #if defined CONFIG_X86_64
 #include <asm/uv/bios.h>
@@ -61,7 +62,7 @@ static struct xpc_heartbeat_uv *xpc_heartbeat_uv;
 					 XPC_NOTIFY_MSG_SIZE_UV)
 #define XPC_NOTIFY_IRQ_NAME		"xpc_notify"
 
-static int xpc_mq_node = -1;
+static int xpc_mq_node = NUMA_NO_NODE;
 
 static struct xpc_gru_mq_uv *xpc_activate_mq_uv;
 static struct xpc_gru_mq_uv *xpc_notify_mq_uv;
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 113b38e..e33928c 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -27,6 +27,7 @@
 #include <linux/bpf.h>
 #include <linux/bpf_trace.h>
 #include <linux/atomic.h>
+#include <linux/numa.h>
 #include <scsi/fc/fc_fcoe.h>
 #include <net/udp_tunnel.h>
 #include <net/pkt_cls.h>
@@ -6414,7 +6415,7 @@ int ixgbe_setup_tx_resources(struct ixgbe_ring *tx_ring)
 {
 	struct device *dev = tx_ring->dev;
 	int orig_node = dev_to_node(dev);
-	int ring_node = -1;
+	int ring_node = NUMA_NO_NODE;
 	int size;
 
 	size = sizeof(struct ixgbe_tx_buffer) * tx_ring->count;
@@ -6508,7 +6509,7 @@ int ixgbe_setup_rx_resources(struct ixgbe_adapter *adapter,
 {
 	struct device *dev = rx_ring->dev;
 	int orig_node = dev_to_node(dev);
-	int ring_node = -1;
+	int ring_node = NUMA_NO_NODE;
 	int size;
 
 	size = sizeof(struct ixgbe_rx_buffer) * rx_ring->count;
diff --git a/include/linux/device.h b/include/linux/device.h
index 1b25c7a..4921a61 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1085,7 +1085,7 @@ static inline void set_dev_node(struct device *dev, int node)
 #else
 static inline int dev_to_node(struct device *dev)
 {
-	return -1;
+	return NUMA_NO_NODE;
 }
 static inline void set_dev_node(struct device *dev, int node)
 {
diff --git a/init/init_task.c b/init/init_task.c
index 5aebe3b..26131e7 100644
--- a/init/init_task.c
+++ b/init/init_task.c
@@ -10,6 +10,7 @@
 #include <linux/fs.h>
 #include <linux/mm.h>
 #include <linux/audit.h>
+#include <linux/numa.h>
 
 #include <asm/pgtable.h>
 #include <linux/uaccess.h>
@@ -154,7 +155,7 @@ struct task_struct init_task
 	.vtime.state	= VTIME_SYS,
 #endif
 #ifdef CONFIG_NUMA_BALANCING
-	.numa_preferred_nid = -1,
+	.numa_preferred_nid = NUMA_NO_NODE,
 	.numa_group	= NULL,
 	.numa_faults	= NULL,
 #endif
diff --git a/kernel/kthread.c b/kernel/kthread.c
index 087d18d..ebebbcf 100644
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@ -20,6 +20,7 @@
 #include <linux/freezer.h>
 #include <linux/ptrace.h>
 #include <linux/uaccess.h>
+#include <linux/numa.h>
 #include <trace/events/sched.h>
 
 static DEFINE_SPINLOCK(kthread_create_lock);
@@ -675,7 +676,7 @@ __kthread_create_worker(int cpu, unsigned int flags,
 {
 	struct kthread_worker *worker;
 	struct task_struct *task;
-	int node = -1;
+	int node = NUMA_NO_NODE;
 
 	worker = kzalloc(sizeof(*worker), GFP_KERNEL);
 	if (!worker)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index ac855b2..2ef0db2 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -1161,7 +1161,7 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
 
 	/* New address space, reset the preferred nid */
 	if (!(clone_flags & CLONE_VM)) {
-		p->numa_preferred_nid = -1;
+		p->numa_preferred_nid = NUMA_NO_NODE;
 		return;
 	}
 
@@ -1181,13 +1181,13 @@ void init_numa_balancing(unsigned long clone_flags, struct task_struct *p)
 
 static void account_numa_enqueue(struct rq *rq, struct task_struct *p)
 {
-	rq->nr_numa_running += (p->numa_preferred_nid != -1);
+	rq->nr_numa_running += (p->numa_preferred_nid != NUMA_NO_NODE);
 	rq->nr_preferred_running += (p->numa_preferred_nid == task_node(p));
 }
 
 static void account_numa_dequeue(struct rq *rq, struct task_struct *p)
 {
-	rq->nr_numa_running -= (p->numa_preferred_nid != -1);
+	rq->nr_numa_running -= (p->numa_preferred_nid != NUMA_NO_NODE);
 	rq->nr_preferred_running -= (p->numa_preferred_nid == task_node(p));
 }
 
@@ -1401,7 +1401,7 @@ bool should_numa_migrate_memory(struct task_struct *p, struct page * page,
 	 * two full passes of the "multi-stage node selection" test that is
 	 * executed below.
 	 */
-	if ((p->numa_preferred_nid == -1 || p->numa_scan_seq <= 4) &&
+	if ((p->numa_preferred_nid == NUMA_NO_NODE || p->numa_scan_seq <= 4) &&
 	    (cpupid_pid_unset(last_cpupid) || cpupid_match_pid(p, last_cpupid)))
 		return true;
 
@@ -1849,7 +1849,7 @@ static void numa_migrate_preferred(struct task_struct *p)
 	unsigned long interval = HZ;
 
 	/* This task has no NUMA fault statistics yet */
-	if (unlikely(p->numa_preferred_nid == -1 || !p->numa_faults))
+	if (unlikely(p->numa_preferred_nid == NUMA_NO_NODE || !p->numa_faults))
 		return;
 
 	/* Periodically retry migrating the task to the preferred node */
@@ -2096,7 +2096,7 @@ static int preferred_group_nid(struct task_struct *p, int nid)
 
 static void task_numa_placement(struct task_struct *p)
 {
-	int seq, nid, max_nid = -1;
+	int seq, nid, max_nid = NUMA_NO_NODE;
 	unsigned long max_faults = 0;
 	unsigned long fault_types[2] = { 0, 0 };
 	unsigned long total_faults;
@@ -2639,7 +2639,8 @@ static void update_scan_period(struct task_struct *p, int new_cpu)
 		 * the preferred node.
 		 */
 		if (dst_nid == p->numa_preferred_nid ||
-		    (p->numa_preferred_nid != -1 && src_nid != p->numa_preferred_nid))
+		    (p->numa_preferred_nid != NUMA_NO_NODE &&
+			src_nid != p->numa_preferred_nid))
 			return;
 	}
 
diff --git a/lib/cpumask.c b/lib/cpumask.c
index 8d666ab..087a3e9 100644
--- a/lib/cpumask.c
+++ b/lib/cpumask.c
@@ -5,6 +5,7 @@
 #include <linux/cpumask.h>
 #include <linux/export.h>
 #include <linux/memblock.h>
+#include <linux/numa.h>
 
 /**
  * cpumask_next - get the next cpu in a cpumask
@@ -206,7 +207,7 @@ unsigned int cpumask_local_spread(unsigned int i, int node)
 	/* Wrap: we always want a cpu. */
 	i %= num_online_cpus();
 
-	if (node == -1) {
+	if (node == NUMA_NO_NODE) {
 		for_each_cpu(cpu, cpu_online_mask)
 			if (i-- == 0)
 				return cpu;
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
index 55478ab..84bd7bf 100644
--- a/mm/huge_memory.c
+++ b/mm/huge_memory.c
@@ -33,6 +33,7 @@
 #include <linux/page_idle.h>
 #include <linux/shmem_fs.h>
 #include <linux/oom.h>
+#include <linux/numa.h>
 
 #include <asm/tlb.h>
 #include <asm/pgalloc.h>
@@ -1480,7 +1481,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
 	struct anon_vma *anon_vma = NULL;
 	struct page *page;
 	unsigned long haddr = vmf->address & HPAGE_PMD_MASK;
-	int page_nid = -1, this_nid = numa_node_id();
+	int page_nid = NUMA_NO_NODE, this_nid = numa_node_id();
 	int target_nid, last_cpupid = -1;
 	bool page_locked;
 	bool migrated = false;
@@ -1526,7 +1527,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
 	 */
 	page_locked = trylock_page(page);
 	target_nid = mpol_misplaced(page, vma, haddr);
-	if (target_nid == -1) {
+	if (target_nid == NUMA_NO_NODE) {
 		/* If the page was locked, there are no parallel migrations */
 		if (page_locked)
 			goto clear_pmdnuma;
@@ -1534,7 +1535,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
 
 	/* Migration could have started since the pmd_trans_migrating check */
 	if (!page_locked) {
-		page_nid = -1;
+		page_nid = NUMA_NO_NODE;
 		if (!get_page_unless_zero(page))
 			goto out_unlock;
 		spin_unlock(vmf->ptl);
@@ -1556,14 +1557,14 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
 	if (unlikely(!pmd_same(pmd, *vmf->pmd))) {
 		unlock_page(page);
 		put_page(page);
-		page_nid = -1;
+		page_nid = NUMA_NO_NODE;
 		goto out_unlock;
 	}
 
 	/* Bail if we fail to protect against THP splits for any reason */
 	if (unlikely(!anon_vma)) {
 		put_page(page);
-		page_nid = -1;
+		page_nid = NUMA_NO_NODE;
 		goto clear_pmdnuma;
 	}
 
@@ -1625,7 +1626,7 @@ vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)
 	if (anon_vma)
 		page_unlock_anon_vma_read(anon_vma);
 
-	if (page_nid != -1)
+	if (page_nid != NUMA_NO_NODE)
 		task_numa_fault(last_cpupid, page_nid, HPAGE_PMD_NR,
 				flags);
 
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 7f2a28a..626c771 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -25,6 +25,7 @@
 #include <linux/swap.h>
 #include <linux/swapops.h>
 #include <linux/jhash.h>
+#include <linux/numa.h>
 
 #include <asm/page.h>
 #include <asm/pgtable.h>
@@ -887,7 +888,7 @@ static struct page *dequeue_huge_page_nodemask(struct hstate *h, gfp_t gfp_mask,
 	struct zonelist *zonelist;
 	struct zone *zone;
 	struct zoneref *z;
-	int node = -1;
+	int node = NUMA_NO_NODE;
 
 	zonelist = node_zonelist(nid, gfp_mask);
 
diff --git a/mm/ksm.c b/mm/ksm.c
index 5b0894b..d5f8834 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -597,7 +597,7 @@ static struct stable_node *alloc_stable_node_chain(struct stable_node *dup,
 		chain->chain_prune_time = jiffies;
 		chain->rmap_hlist_len = STABLE_NODE_CHAIN;
 #if defined (CONFIG_DEBUG_VM) && defined(CONFIG_NUMA)
-		chain->nid = -1; /* debug */
+		chain->nid = NUMA_NO_NODE; /* debug */
 #endif
 		ksm_stable_node_chains++;
 
diff --git a/mm/memory.c b/mm/memory.c
index 4ad2d29..ed324f8 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -69,6 +69,7 @@
 #include <linux/userfaultfd_k.h>
 #include <linux/dax.h>
 #include <linux/oom.h>
+#include <linux/numa.h>
 
 #include <asm/io.h>
 #include <asm/mmu_context.h>
@@ -3564,7 +3565,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
 {
 	struct vm_area_struct *vma = vmf->vma;
 	struct page *page = NULL;
-	int page_nid = -1;
+	int page_nid = NUMA_NO_NODE;
 	int last_cpupid;
 	int target_nid;
 	bool migrated = false;
@@ -3631,7 +3632,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
 	target_nid = numa_migrate_prep(page, vma, vmf->address, page_nid,
 			&flags);
 	pte_unmap_unlock(vmf->pte, vmf->ptl);
-	if (target_nid == -1) {
+	if (target_nid == NUMA_NO_NODE) {
 		put_page(page);
 		goto out;
 	}
@@ -3645,7 +3646,7 @@ static vm_fault_t do_numa_page(struct vm_fault *vmf)
 		flags |= TNF_MIGRATE_FAIL;
 
 out:
-	if (page_nid != -1)
+	if (page_nid != NUMA_NO_NODE)
 		task_numa_fault(last_cpupid, page_nid, 1, flags);
 	return 0;
 }
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 2b2b3cc..70e02f8 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -688,9 +688,9 @@ static void node_states_check_changes_online(unsigned long nr_pages,
 {
 	int nid = zone_to_nid(zone);
 
-	arg->status_change_nid = -1;
-	arg->status_change_nid_normal = -1;
-	arg->status_change_nid_high = -1;
+	arg->status_change_nid = NUMA_NO_NODE;
+	arg->status_change_nid_normal = NUMA_NO_NODE;
+	arg->status_change_nid_high = NUMA_NO_NODE;
 
 	if (!node_state(nid, N_MEMORY))
 		arg->status_change_nid = nid;
@@ -1484,9 +1484,9 @@ static void node_states_check_changes_offline(unsigned long nr_pages,
 	unsigned long present_pages = 0;
 	enum zone_type zt;
 
-	arg->status_change_nid = -1;
-	arg->status_change_nid_normal = -1;
-	arg->status_change_nid_high = -1;
+	arg->status_change_nid = NUMA_NO_NODE;
+	arg->status_change_nid_normal = NUMA_NO_NODE;
+	arg->status_change_nid_high = NUMA_NO_NODE;
 
 	/*
 	 * Check whether node_states[N_NORMAL_MEMORY] will be changed.
diff --git a/mm/mempolicy.c b/mm/mempolicy.c
index 5837a06..e4f8248 100644
--- a/mm/mempolicy.c
+++ b/mm/mempolicy.c
@@ -2278,7 +2278,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
 	unsigned long pgoff;
 	int thiscpu = raw_smp_processor_id();
 	int thisnid = cpu_to_node(thiscpu);
-	int polnid = -1;
+	int polnid = NUMA_NO_NODE;
 	int ret = -1;
 
 	pol = get_vma_policy(vma, addr);
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6847177..73cf534 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5844,7 +5844,7 @@ int __meminit __early_pfn_to_nid(unsigned long pfn,
 		return state->last_nid;
 
 	nid = memblock_search_pfn_nid(pfn, &start_pfn, &end_pfn);
-	if (nid != -1) {
+	if (nid != NUMA_NO_NODE) {
 		state->last_start = start_pfn;
 		state->last_end = end_pfn;
 		state->last_nid = nid;
@@ -6605,7 +6605,7 @@ unsigned long __init node_map_pfn_alignment(void)
 {
 	unsigned long accl_mask = 0, last_end = 0;
 	unsigned long start, end, mask;
-	int last_nid = -1;
+	int last_nid = NUMA_NO_NODE;
 	int i, nid;
 
 	for_each_mem_pfn_range(i, MAX_NUMNODES, &start, &end, &nid) {
diff --git a/mm/page_ext.c b/mm/page_ext.c
index ae44f7a..dfb0206 100644
--- a/mm/page_ext.c
+++ b/mm/page_ext.c
@@ -300,7 +300,7 @@ static int __meminit online_page_ext(unsigned long start_pfn,
 	start = SECTION_ALIGN_DOWN(start_pfn);
 	end = SECTION_ALIGN_UP(start_pfn + nr_pages);
 
-	if (nid == -1) {
+	if (nid == NUMA_NO_NODE) {
 		/*
 		 * In this case, "nid" already exists and contains valid memory.
 		 * "start_pfn" passed to us is a pfn which is an arg for
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index 6ac9198..f3f5a78 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -158,6 +158,7 @@
 #include <linux/etherdevice.h>
 #include <linux/kthread.h>
 #include <linux/prefetch.h>
+#include <linux/mmzone.h>
 #include <net/net_namespace.h>
 #include <net/checksum.h>
 #include <net/ipv6.h>
@@ -3625,7 +3626,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
 	pkt_dev->svlan_cfi = 0;
 	pkt_dev->svlan_id = 0xffff;
 	pkt_dev->burst = 1;
-	pkt_dev->node = -1;
+	pkt_dev->node = NUMA_NO_NODE;
 
 	err = pktgen_setup_dev(t->net, pkt_dev, ifname);
 	if (err)
diff --git a/net/qrtr/qrtr.c b/net/qrtr/qrtr.c
index 86e1e37..b37e6e0 100644
--- a/net/qrtr/qrtr.c
+++ b/net/qrtr/qrtr.c
@@ -15,6 +15,7 @@
 #include <linux/netlink.h>
 #include <linux/qrtr.h>
 #include <linux/termios.h>	/* For TIOCINQ/OUTQ */
+#include <linux/numa.h>
 
 #include <net/sock.h>
 
@@ -101,7 +102,7 @@ static inline struct qrtr_sock *qrtr_sk(struct sock *sk)
 	return container_of(sk, struct qrtr_sock, sk);
 }
 
-static unsigned int qrtr_local_nid = -1;
+static unsigned int qrtr_local_nid = NUMA_NO_NODE;
 
 /* for node ids */
 static RADIX_TREE(qrtr_nodes, GFP_KERNEL);
diff --git a/tools/perf/bench/numa.c b/tools/perf/bench/numa.c
index 4419551..e0ad5f1 100644
--- a/tools/perf/bench/numa.c
+++ b/tools/perf/bench/numa.c
@@ -298,7 +298,7 @@ static cpu_set_t bind_to_node(int target_node)
 
 	CPU_ZERO(&mask);
 
-	if (target_node == -1) {
+	if (target_node == NUMA_NO_NODE) {
 		for (cpu = 0; cpu < g->p.nr_cpus; cpu++)
 			CPU_SET(cpu, &mask);
 	} else {
@@ -339,7 +339,7 @@ static void bind_to_memnode(int node)
 	unsigned long nodemask;
 	int ret;
 
-	if (node == -1)
+	if (node == NUMA_NO_NODE)
 		return;
 
 	BUG_ON(g->p.nr_nodes > (int)sizeof(nodemask)*8);
@@ -1363,7 +1363,7 @@ static void init_thread_data(void)
 		int cpu;
 
 		/* Allow all nodes by default: */
-		td->bind_node = -1;
+		td->bind_node = NUMA_NO_NODE;
 
 		/* Allow all CPUs by default: */
 		CPU_ZERO(&td->bind_cpumask);

^ permalink raw reply related

* dmaengine: dmatest: wrap src & dst data into a struct
From: Alexandru Ardelean @ 2018-11-26  8:43 UTC (permalink / raw)
  To: dmaengine, vkoul; +Cc: Alexandru Ardelean

There's a bit too much un-wrapped & duplicated code that can be organized
into some common logic/functions.

This change wraps all the common parts between srcs & dsts into a
`dmatest_data` struct. The purpose is to split the `dmatestfunc` into
smaller chunks that are easier to follow & extend.

Signed-off-by: Alexandru Ardelean <alexandru.ardelean@analog.com>
---
 drivers/dma/dmatest.c | 257 ++++++++++++++++++++++--------------------
 1 file changed, 133 insertions(+), 124 deletions(-)

diff --git a/drivers/dma/dmatest.c b/drivers/dma/dmatest.c
index e71aa1e3451c..c37c643e7d29 100644
--- a/drivers/dma/dmatest.c
+++ b/drivers/dma/dmatest.c
@@ -166,15 +166,20 @@ struct dmatest_done {
 	wait_queue_head_t	*wait;
 };
 
+struct dmatest_data {
+	u8		**raw;
+	u8		**aligned;
+	unsigned int	cnt;
+	unsigned int	off;
+};
+
 struct dmatest_thread {
 	struct list_head	node;
 	struct dmatest_info	*info;
 	struct task_struct	*task;
 	struct dma_chan		*chan;
-	u8			**srcs;
-	u8			**usrcs;
-	u8			**dsts;
-	u8			**udsts;
+	struct dmatest_data	src;
+	struct dmatest_data	dst;
 	enum dma_transaction_type type;
 	wait_queue_head_t done_wait;
 	struct dmatest_done test_done;
@@ -428,6 +433,53 @@ static unsigned long long dmatest_KBs(s64 runtime, unsigned long long len)
 	return dmatest_persec(runtime, len >> 10);
 }
 
+static void __dmatest_free_test_data(struct dmatest_data *d, unsigned int cnt)
+{
+	unsigned int i;
+
+	for (i = 0; i < cnt; i++)
+		kfree(d->raw[i]);
+
+	kfree(d->aligned);
+	kfree(d->raw);
+}
+
+static void dmatest_free_test_data(struct dmatest_data *d)
+{
+	__dmatest_free_test_data(d, d->cnt);
+}
+
+static int dmatest_alloc_test_data(struct dmatest_data *d,
+		unsigned int buf_size, u8 align)
+{
+	unsigned int i = 0;
+
+	d->raw = kcalloc(d->cnt + 1, sizeof(u8 *), GFP_KERNEL);
+	if (!d->raw)
+		return -ENOMEM;
+
+	d->aligned = kcalloc(d->cnt + 1, sizeof(u8 *), GFP_KERNEL);
+	if (!d->aligned)
+		goto err;
+
+	for (i = 0; i < d->cnt; i++) {
+		d->raw[i] = kmalloc(buf_size + align, GFP_KERNEL);
+		if (!d->raw[i])
+			goto err;
+
+		/* align to alignment restriction */
+		if (align)
+			d->aligned[i] = PTR_ALIGN(d->raw[i], align);
+		else
+			d->aligned[i] = d->raw[i];
+	}
+
+	return 0;
+err:
+	__dmatest_free_test_data(d, i);
+	return -ENOMEM;
+}
+
 /*
  * This function repeatedly tests DMA transfers of various lengths and
  * offsets for a given operation type until it is told to exit by
@@ -458,8 +510,9 @@ static int dmatest_func(void *data)
 	enum dma_ctrl_flags 	flags;
 	u8			*pq_coefs = NULL;
 	int			ret;
-	int			src_cnt;
-	int			dst_cnt;
+	unsigned int 		buf_size;
+	struct dmatest_data	*src;
+	struct dmatest_data	*dst;
 	int			i;
 	ktime_t			ktime, start, diff;
 	ktime_t			filltime = 0;
@@ -480,99 +533,64 @@ static int dmatest_func(void *data)
 	params = &info->params;
 	chan = thread->chan;
 	dev = chan->device;
+	src = &thread->src;
+	dst = &thread->dst;
 	if (thread->type == DMA_MEMCPY) {
 		align = dev->copy_align;
-		src_cnt = dst_cnt = 1;
+		src->cnt = dst->cnt = 1;
 	} else if (thread->type == DMA_MEMSET) {
 		align = dev->fill_align;
-		src_cnt = dst_cnt = 1;
+		src->cnt = dst->cnt = 1;
 		is_memset = true;
 	} else if (thread->type == DMA_XOR) {
 		/* force odd to ensure dst = src */
-		src_cnt = min_odd(params->xor_sources | 1, dev->max_xor);
-		dst_cnt = 1;
+		src->cnt = min_odd(params->xor_sources | 1, dev->max_xor);
+		dst->cnt = 1;
 		align = dev->xor_align;
 	} else if (thread->type == DMA_PQ) {
 		/* force odd to ensure dst = src */
-		src_cnt = min_odd(params->pq_sources | 1, dma_maxpq(dev, 0));
-		dst_cnt = 2;
+		src->cnt = min_odd(params->pq_sources | 1, dma_maxpq(dev, 0));
+		dst->cnt = 2;
 		align = dev->pq_align;
 
 		pq_coefs = kmalloc(params->pq_sources + 1, GFP_KERNEL);
 		if (!pq_coefs)
 			goto err_thread_type;
 
-		for (i = 0; i < src_cnt; i++)
+		for (i = 0; i < src->cnt; i++)
 			pq_coefs[i] = 1;
 	} else
 		goto err_thread_type;
 
 	/* Check if buffer count fits into map count variable (u8) */
-	if ((src_cnt + dst_cnt) >= 255) {
+	if ((src->cnt + dst->cnt) >= 255) {
 		pr_err("too many buffers (%d of 255 supported)\n",
-		       src_cnt + dst_cnt);
+		       src->cnt + dst->cnt);
 		goto err_thread_type;
 	}
 
+	buf_size = params->buf_size;
 	if (1 << align > params->buf_size) {
 		pr_err("%u-byte buffer too small for %d-byte alignment\n",
 		       params->buf_size, 1 << align);
 		goto err_thread_type;
 	}
 
-	thread->srcs = kcalloc(src_cnt + 1, sizeof(u8 *), GFP_KERNEL);
-	if (!thread->srcs)
-		goto err_srcs;
-
-	thread->usrcs = kcalloc(src_cnt + 1, sizeof(u8 *), GFP_KERNEL);
-	if (!thread->usrcs)
-		goto err_usrcs;
+	if (dmatest_alloc_test_data(src, buf_size, align) < 0)
+		goto err_src;
 
-	for (i = 0; i < src_cnt; i++) {
-		thread->usrcs[i] = kmalloc(params->buf_size + align,
-					   GFP_KERNEL);
-		if (!thread->usrcs[i])
-			goto err_srcbuf;
-
-		/* align srcs to alignment restriction */
-		if (align)
-			thread->srcs[i] = PTR_ALIGN(thread->usrcs[i], align);
-		else
-			thread->srcs[i] = thread->usrcs[i];
-	}
-	thread->srcs[i] = NULL;
-
-	thread->dsts = kcalloc(dst_cnt + 1, sizeof(u8 *), GFP_KERNEL);
-	if (!thread->dsts)
-		goto err_dsts;
-
-	thread->udsts = kcalloc(dst_cnt + 1, sizeof(u8 *), GFP_KERNEL);
-	if (!thread->udsts)
-		goto err_udsts;
-
-	for (i = 0; i < dst_cnt; i++) {
-		thread->udsts[i] = kmalloc(params->buf_size + align,
-					   GFP_KERNEL);
-		if (!thread->udsts[i])
-			goto err_dstbuf;
-
-		/* align dsts to alignment restriction */
-		if (align)
-			thread->dsts[i] = PTR_ALIGN(thread->udsts[i], align);
-		else
-			thread->dsts[i] = thread->udsts[i];
-	}
-	thread->dsts[i] = NULL;
+	if (dmatest_alloc_test_data(dst, buf_size, align) < 0)
+		goto err_dst;
 
 	set_user_nice(current, 10);
 
-	srcs = kcalloc(src_cnt, sizeof(dma_addr_t), GFP_KERNEL);
+	srcs = kcalloc(src->cnt, sizeof(dma_addr_t), GFP_KERNEL);
 	if (!srcs)
-		goto err_dstbuf;
+		goto err_srcs;
 
-	dma_pq = kcalloc(dst_cnt, sizeof(dma_addr_t), GFP_KERNEL);
+	dma_pq = kcalloc(dst->cnt, sizeof(dma_addr_t), GFP_KERNEL);
 	if (!dma_pq)
-		goto err_srcs_array;
+		goto err_dma_pq;
 
 	/*
 	 * src and dst buffers are freed by ourselves below
@@ -585,7 +603,7 @@ static int dmatest_func(void *data)
 		struct dma_async_tx_descriptor *tx = NULL;
 		struct dmaengine_unmap_data *um;
 		dma_addr_t *dsts;
-		unsigned int src_off, dst_off, len;
+		unsigned int len;
 
 		total_tests++;
 
@@ -601,59 +619,59 @@ static int dmatest_func(void *data)
 		total_len += len;
 
 		if (params->norandom) {
-			src_off = 0;
-			dst_off = 0;
+			src->off = 0;
+			dst->off = 0;
 		} else {
-			src_off = dmatest_random() % (params->buf_size - len + 1);
-			dst_off = dmatest_random() % (params->buf_size - len + 1);
+			src->off = dmatest_random() % (params->buf_size - len + 1);
+			dst->off = dmatest_random() % (params->buf_size - len + 1);
 
-			src_off = (src_off >> align) << align;
-			dst_off = (dst_off >> align) << align;
+			src->off = (src->off >> align) << align;
+			dst->off = (dst->off >> align) << align;
 		}
 
 		if (!params->noverify) {
 			start = ktime_get();
-			dmatest_init_srcs(thread->srcs, src_off, len,
+			dmatest_init_srcs(src->aligned, src->off, len,
 					  params->buf_size, is_memset);
-			dmatest_init_dsts(thread->dsts, dst_off, len,
+			dmatest_init_dsts(dst->aligned, dst->off, len,
 					  params->buf_size, is_memset);
 
 			diff = ktime_sub(ktime_get(), start);
 			filltime = ktime_add(filltime, diff);
 		}
 
-		um = dmaengine_get_unmap_data(dev->dev, src_cnt + dst_cnt,
+		um = dmaengine_get_unmap_data(dev->dev, src->cnt + dst->cnt,
 					      GFP_KERNEL);
 		if (!um) {
 			failed_tests++;
 			result("unmap data NULL", total_tests,
-			       src_off, dst_off, len, ret);
+			       src->off, dst->off, len, ret);
 			continue;
 		}
 
 		um->len = params->buf_size;
-		for (i = 0; i < src_cnt; i++) {
-			void *buf = thread->srcs[i];
+		for (i = 0; i < src->cnt; i++) {
+			void *buf = src->aligned[i];
 			struct page *pg = virt_to_page(buf);
 			unsigned long pg_off = offset_in_page(buf);
 
 			um->addr[i] = dma_map_page(dev->dev, pg, pg_off,
 						   um->len, DMA_TO_DEVICE);
-			srcs[i] = um->addr[i] + src_off;
+			srcs[i] = um->addr[i] + src->off;
 			ret = dma_mapping_error(dev->dev, um->addr[i]);
 			if (ret) {
 				dmaengine_unmap_put(um);
 				result("src mapping error", total_tests,
-				       src_off, dst_off, len, ret);
+				       src->off, dst->off, len, ret);
 				failed_tests++;
 				continue;
 			}
 			um->to_cnt++;
 		}
 		/* map with DMA_BIDIRECTIONAL to force writeback/invalidate */
-		dsts = &um->addr[src_cnt];
-		for (i = 0; i < dst_cnt; i++) {
-			void *buf = thread->dsts[i];
+		dsts = &um->addr[src->cnt];
+		for (i = 0; i < dst->cnt; i++) {
+			void *buf = dst->aligned[i];
 			struct page *pg = virt_to_page(buf);
 			unsigned long pg_off = offset_in_page(buf);
 
@@ -663,7 +681,7 @@ static int dmatest_func(void *data)
 			if (ret) {
 				dmaengine_unmap_put(um);
 				result("dst mapping error", total_tests,
-				       src_off, dst_off, len, ret);
+				       src->off, dst->off, len, ret);
 				failed_tests++;
 				continue;
 			}
@@ -672,30 +690,30 @@ static int dmatest_func(void *data)
 
 		if (thread->type == DMA_MEMCPY)
 			tx = dev->device_prep_dma_memcpy(chan,
-							 dsts[0] + dst_off,
+							 dsts[0] + dst->off,
 							 srcs[0], len, flags);
 		else if (thread->type == DMA_MEMSET)
 			tx = dev->device_prep_dma_memset(chan,
-						dsts[0] + dst_off,
-						*(thread->srcs[0] + src_off),
+						dsts[0] + dst->off,
+						*(src->aligned[0] + src->off),
 						len, flags);
 		else if (thread->type == DMA_XOR)
 			tx = dev->device_prep_dma_xor(chan,
-						      dsts[0] + dst_off,
-						      srcs, src_cnt,
+						      dsts[0] + dst->off,
+						      srcs, src->cnt,
 						      len, flags);
 		else if (thread->type == DMA_PQ) {
-			for (i = 0; i < dst_cnt; i++)
-				dma_pq[i] = dsts[i] + dst_off;
+			for (i = 0; i < dst->cnt; i++)
+				dma_pq[i] = dsts[i] + dst->off;
 			tx = dev->device_prep_dma_pq(chan, dma_pq, srcs,
-						     src_cnt, pq_coefs,
+						     src->cnt, pq_coefs,
 						     len, flags);
 		}
 
 		if (!tx) {
 			dmaengine_unmap_put(um);
-			result("prep error", total_tests, src_off,
-			       dst_off, len, ret);
+			result("prep error", total_tests, src->off,
+			       dst->off, len, ret);
 			msleep(100);
 			failed_tests++;
 			continue;
@@ -708,8 +726,8 @@ static int dmatest_func(void *data)
 
 		if (dma_submit_error(cookie)) {
 			dmaengine_unmap_put(um);
-			result("submit error", total_tests, src_off,
-			       dst_off, len, ret);
+			result("submit error", total_tests, src->off,
+			       dst->off, len, ret);
 			msleep(100);
 			failed_tests++;
 			continue;
@@ -724,58 +742,58 @@ static int dmatest_func(void *data)
 		dmaengine_unmap_put(um);
 
 		if (!done->done) {
-			result("test timed out", total_tests, src_off, dst_off,
+			result("test timed out", total_tests, src->off, dst->off,
 			       len, 0);
 			failed_tests++;
 			continue;
 		} else if (status != DMA_COMPLETE) {
 			result(status == DMA_ERROR ?
 			       "completion error status" :
-			       "completion busy status", total_tests, src_off,
-			       dst_off, len, ret);
+			       "completion busy status", total_tests, src->off,
+			       dst->off, len, ret);
 			failed_tests++;
 			continue;
 		}
 
 		if (params->noverify) {
-			verbose_result("test passed", total_tests, src_off,
-				       dst_off, len, 0);
+			verbose_result("test passed", total_tests, src->off,
+				       dst->off, len, 0);
 			continue;
 		}
 
 		start = ktime_get();
 		pr_debug("%s: verifying source buffer...\n", current->comm);
-		error_count = dmatest_verify(thread->srcs, 0, src_off,
+		error_count = dmatest_verify(src->aligned, 0, src->off,
 				0, PATTERN_SRC, true, is_memset);
-		error_count += dmatest_verify(thread->srcs, src_off,
-				src_off + len, src_off,
+		error_count += dmatest_verify(src->aligned, src->off,
+				src->off + len, src->off,
 				PATTERN_SRC | PATTERN_COPY, true, is_memset);
-		error_count += dmatest_verify(thread->srcs, src_off + len,
-				params->buf_size, src_off + len,
+		error_count += dmatest_verify(src->aligned, src->off + len,
+				params->buf_size, src->off + len,
 				PATTERN_SRC, true, is_memset);
 
 		pr_debug("%s: verifying dest buffer...\n", current->comm);
-		error_count += dmatest_verify(thread->dsts, 0, dst_off,
+		error_count += dmatest_verify(dst->aligned, 0, dst->off,
 				0, PATTERN_DST, false, is_memset);
 
-		error_count += dmatest_verify(thread->dsts, dst_off,
-				dst_off + len, src_off,
+		error_count += dmatest_verify(dst->aligned, dst->off,
+				dst->off + len, src->off,
 				PATTERN_SRC | PATTERN_COPY, false, is_memset);
 
-		error_count += dmatest_verify(thread->dsts, dst_off + len,
-				params->buf_size, dst_off + len,
+		error_count += dmatest_verify(dst->aligned, dst->off + len,
+				params->buf_size, dst->off + len,
 				PATTERN_DST, false, is_memset);
 
 		diff = ktime_sub(ktime_get(), start);
 		comparetime = ktime_add(comparetime, diff);
 
 		if (error_count) {
-			result("data error", total_tests, src_off, dst_off,
+			result("data error", total_tests, src->off, dst->off,
 			       len, error_count);
 			failed_tests++;
 		} else {
-			verbose_result("test passed", total_tests, src_off,
-				       dst_off, len, 0);
+			verbose_result("test passed", total_tests, src->off,
+				       dst->off, len, 0);
 		}
 	}
 	ktime = ktime_sub(ktime_get(), ktime);
@@ -785,22 +803,13 @@ static int dmatest_func(void *data)
 
 	ret = 0;
 	kfree(dma_pq);
-err_srcs_array:
+err_dma_pq:
 	kfree(srcs);
-err_dstbuf:
-	for (i = 0; thread->udsts[i]; i++)
-		kfree(thread->udsts[i]);
-	kfree(thread->udsts);
-err_udsts:
-	kfree(thread->dsts);
-err_dsts:
-err_srcbuf:
-	for (i = 0; thread->usrcs[i]; i++)
-		kfree(thread->usrcs[i]);
-	kfree(thread->usrcs);
-err_usrcs:
-	kfree(thread->srcs);
 err_srcs:
+	dmatest_free_test_data(dst);
+err_dst:
+	dmatest_free_test_data(src);
+err_src:
 	kfree(pq_coefs);
 err_thread_type:
 	pr_info("%s: summary %u tests, %u failures %llu iops %llu KB/s (%d)\n",

^ permalink raw reply related

* linux-next: build warning after merge of the slave-dma tree
From: Vinod Koul @ 2018-11-26  8:09 UTC (permalink / raw)
  To: Stephen Rothwell
  Cc: Linux Next Mailing List, Linux Kernel Mailing List, Jia-Ju Bai,
	dma

Hi Stephen,

On 26-11-18, 16:59, Stephen Rothwell wrote:
> Hi Vinod,
> 
> After merging the slave-dma tree, today's linux-next build (x86_64
> allmodconfig) produced this warning:
> 
> drivers/dma/coh901318.c: In function 'coh901318_config':
> drivers/dma/coh901318.c:1805:16: warning: unused variable 'flags' [-Wunused-variable]
>   unsigned long flags;
>                 ^~~~~
> 
> Introduced by commit
> 
>   627469e4445b ("dmaengine: coh901318: Fix a double-lock bug")

Thanks for the report, I have fixed it up with below:

-- >8 --

From fbbdec195155b4497cb83be37788865f98f31dca Mon Sep 17 00:00:00 2001
From: Vinod Koul <vkoul@kernel.org>
Date: Mon, 26 Nov 2018 13:34:15 +0530
Subject: [PATCH] dmaengine: coh901318: Remove unused variable

Commit 627469e4445b ("dmaengine: coh901318: Fix a double-lock bug") left
flags variable unused, so remove it to fix the warning.

drivers/dma/coh901318.c: In function 'coh901318_config':
drivers/dma/coh901318.c:1805:16: warning: unused variable 'flags' [-Wunused-variable]
  unsigned long flags;
                ^~~~~

Reported-By: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
---
 drivers/dma/coh901318.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
index fd862a478738..b69d66e44052 100644
--- a/drivers/dma/coh901318.c
+++ b/drivers/dma/coh901318.c
@@ -1802,7 +1802,6 @@ static struct dma_chan *coh901318_xlate(struct of_phandle_args *dma_spec,
 static int coh901318_config(struct coh901318_chan *cohc,
 			    struct coh901318_params *param)
 {
-	unsigned long flags;
 	const struct coh901318_params *p;
 	int channel = cohc->id;
 	void __iomem *virtbase = cohc->base->virtbase;

^ permalink raw reply related

* mm: Replace all open encodings for NUMA_NO_NODE
From: Anshuman Khandual @ 2018-11-26  6:45 UTC (permalink / raw)
  To: Vinod Koul
  Cc: linux-mm, linux-kernel, ocfs2-devel, linux-fbdev, dri-devel,
	netdev, intel-wired-lan, linux-media, iommu, linux-rdma,
	dmaengine, linux-block, sparclinux, linuxppc-dev, linux-ia64,
	linux-alpha, akpm, jiangqi903, hverkuil

On 11/24/2018 07:35 PM, Vinod Koul wrote:
> On 23-11-18, 15:24, Anshuman Khandual wrote:
> 
>> --- a/drivers/dma/dmaengine.c
>> +++ b/drivers/dma/dmaengine.c
>> @@ -386,7 +386,8 @@ EXPORT_SYMBOL(dma_issue_pending_all);
>>  static bool dma_chan_is_local(struct dma_chan *chan, int cpu)
>>  {
>>  	int node = dev_to_node(chan->device->dev);
>> -	return node == -1 || cpumask_test_cpu(cpu, cpumask_of_node(node));
>> +	return node == NUMA_NO_NODE ||
>> +		cpumask_test_cpu(cpu, cpumask_of_node(node));
>>  }
> 
> I do not see dev_to_node being updated first, that returns -1 so I would
> prefer to check for -1 unless it return NUMA_NO_NODE

Sure will update dev_to_node() to return NUMA_NO_NODE as well.

^ permalink raw reply

* dmaengine: ti: omap-dma: Configure LCH_TYPE for OMAP1
From: Tony Lindgren @ 2018-11-25 17:14 UTC (permalink / raw)
  To: Aaro Koskinen
  Cc: Russell King - ARM Linux, Peter Ujfalusi, vkoul, dan.j.williams,
	dmaengine, linux-kernel, linux-omap

* Aaro Koskinen <aaro.koskinen@iki.fi> [181125 16:58]:
> Below changes get traffic going with DMA & g_ether...

Oh cool, if you have dma and g_ether working, you should
test it with a variable size ping test loop :) That should
expose any issues within few minutes.

Below is the test script I was using earlier, the
tusb6010 comment there is probably no longer valid.

Regards,

Tony

8< ----------------
#!/bin/bash

#
# At least tusb6010 dma needs 32-bit aligned buffers.
# That can be done by setting no_skb_reserve with:
# musb->g.quirk_avoids_skb_reserve = 1;
#

device=$1
size=$2
wraps=0

while [ 1 ]; do
	#echo "Pinging with size $size"
	if ! ping -w0 -c1 -s$size $device > /dev/null 2>&1; then
		break;
	fi
	size=$(expr $size + 1)

	if [ $size -gt 8192 ]; then
		wraps=$(expr $wraps + 1)
		echo "wrapping ($wraps) at $size"
		size=1
	fi
done
echo "Test ran up to $size"

^ permalink raw reply

* dmaengine: ti: omap-dma: Configure LCH_TYPE for OMAP1
From: Aaro Koskinen @ 2018-11-25 16:58 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Tony Lindgren, Peter Ujfalusi, vkoul, dan.j.williams, dmaengine,
	linux-kernel, linux-omap

Hi,

On Sun, Nov 25, 2018 at 11:11:05AM +0000, Russell King - ARM Linux wrote:
> I think we're better off leaving omap-udc well alone, and if it's
> now broken with DMA, then that's unfortunate - it would require
> someone with the hardware to diagnose the problem and fix it.  I
> think trying to convert it to dmaengine would be risking way more
> problems than its worth.

Well, there's also an option to use dmaengine only for 16xx at the
beginning.

My current guess is that 15xx DMA has been broken at least since
65111084c63d ("USB: more omap_udc updates (dma and omap1710)").

There are two changes in that patch that broke it:

"use 16 bit DMA access" ==> CPC off-by-one becomes now off-by-two...?

"allow burst/pack for memory access" ==> no idea why

Below changes get traffic going with DMA & g_ether...

A.

diff --git a/drivers/usb/gadget/udc/omap_udc.c b/drivers/usb/gadget/udc/omap_udc.c
index fcf13ef33b31..8094a0380057 100644
--- a/drivers/usb/gadget/udc/omap_udc.c
+++ b/drivers/usb/gadget/udc/omap_udc.c
@@ -498,7 +498,7 @@ static u16 dma_dest_len(struct omap_ep *ep, dma_addr_t start)
 
 	end |= start & (0xffff << 16);
 	if (cpu_is_omap15xx())
-		end++;
+		end += 2;
 	if (end < start)
 		end += 0x10000;
 	return end - start;
@@ -730,10 +730,12 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
 			ep->ep.name, dma_error, ep, &ep->lch);
 		if (status == 0) {
 			omap_writew(reg, UDC_TXDMA_CFG);
-			/* EMIFF or SDRC */
-			omap_set_dma_src_burst_mode(ep->lch,
-						OMAP_DMA_DATA_BURST_4);
-			omap_set_dma_src_data_pack(ep->lch, 1);
+			if (!cpu_is_omap15xx()) {
+				/* EMIFF or SDRC */
+				omap_set_dma_src_burst_mode(ep->lch,
+							OMAP_DMA_DATA_BURST_4);
+				omap_set_dma_src_data_pack(ep->lch, 1);
+			}
 			/* TIPB */
 			omap_set_dma_dest_params(ep->lch,
 				OMAP_DMA_PORT_TIPB,
@@ -753,10 +755,12 @@ static void dma_channel_claim(struct omap_ep *ep, unsigned channel)
 				OMAP_DMA_AMODE_CONSTANT,
 				UDC_DATA_DMA,
 				0, 0);
-			/* EMIFF or SDRC */
-			omap_set_dma_dest_burst_mode(ep->lch,
-						OMAP_DMA_DATA_BURST_4);
-			omap_set_dma_dest_data_pack(ep->lch, 1);
+			if (!cpu_is_omap15xx()) {
+				/* EMIFF or SDRC */
+				omap_set_dma_dest_burst_mode(ep->lch,
+							OMAP_DMA_DATA_BURST_4);
+				omap_set_dma_dest_data_pack(ep->lch, 1);
+			}
 		}
 	}
 	if (status)

^ permalink raw reply related

* dmaengine: ti: omap-dma: Configure LCH_TYPE for OMAP1
From: Russell King - ARM Linux @ 2018-11-25 11:57 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Aaro Koskinen, Peter Ujfalusi, vkoul, dan.j.williams, dmaengine,
	linux-kernel, linux-omap

On Sun, Nov 25, 2018 at 11:11:05AM +0000, Russell King - ARM Linux wrote:
> On Sat, Nov 24, 2018 at 05:07:17PM -0800, Tony Lindgren wrote:
> > * Russell King - ARM Linux <linux@armlinux.org.uk> [181124 20:10]:
> > > On Fri, Nov 23, 2018 at 08:52:15PM +0200, Aaro Koskinen wrote:
> > > > Hi,
> > > > 
> > > > On Fri, Nov 23, 2018 at 02:35:04PM +0200, Peter Ujfalusi wrote:
> > > > > On 22/11/2018 17.12, Russell King - ARM Linux wrote:
> > > > > > I'm also not sure about this:
> > > > > > 
> > > > > >         if (cpu_is_omap15xx())
> > > > > >                 end++;
> > > > > > 
> > > > > > in dma_dest_len() - is that missing from the omap-dma driver?  It looks
> > > > > > like a work-around for some problem on OMAP15xx, but I can't make sense
> > > > > > about why it's in the UDC driver rather than the legacy DMA driver.
> > > > > 
> > > > > afaik no other legacy drivers were doing similar thing, this must be
> > > > > something which is needed for the omap_udc driver to fix up something?
> > > > 
> > > > Here's the patch that added it: https://marc.info/?l=linux-omap&m=119634396324221&w=2
> > > > 
> > > > "Make DMA-OUT behave on the 1510 ... the 1510 CPC register was just
> > > > off-by-one with respect to the 1611 CDAC"
> > > 
> > > ... which suggests that's a problem with the CPC register itself, and
> > > we should fix that in the DMAengine driver rather than the USB gadget
> > > driver.
> > > 
> > > Tony, any input on this?
> > 
> > Yeah that sounds like some hardware work-around for 15xx as described
> > in the DMA_DEST_LAST macro reading CSAC on 15xx instead of CDAC. Seems
> > like it should be done in the dmaengine driver.. My guess is that other
> > dma users never needed to read CSAC register?
> 
> Hmm, reading the OMAP1510 TRM for the CPC register, it seems that
> omap-dma won't handle this particularly well.  The fact that the
> register only updates after the last request in an element or frame
> means that if we try to use this value as the current source /
> destination address before the first transfer, it can be wildly
> wrong.
> 
> Saving the current value at the beginning of a request, and detecting
> if it's changed (like omap_udc) isn't going to work well in the
> generic case.  If, say, the register happens to contain 0x0004, and
> our next transfer is using 32-bit elements in element sync mode
> starting at address with lsb 16 bits as 0, it would mean we'd see
> 0x0004 in this register after the _second_ element has been
> transferred, and we'd assume that the register hasn't yet changed -
> but we would have in reality transferred two elements.
> 
> However, omap-dma.c zeros the CPC register before each transfer,
> which is interesting, because in one place the OMAP1510 TRM says
> that the CPC register is read/write, but in the actual description
> of this register, it says it's read-only.
> 
> What it also means is that, in such a case, after the 2nd element has
> been transferred, where the register contains 0x0004, the address
> we'd be looking for (to calculate the residual) should be 0x0008,
> not 0x0005, so we actually need to be adding the number of bytes
> according to element size.
> 
> Looking at omap-dma.c, someone has added support for the residue
> granularity:
> 
>         if (__dma_omap15xx(od->plat->dma_attr))
>                 od->ddev.residue_granularity =
>                                 DMA_RESIDUE_GRANULARITY_DESCRIPTOR;
>         else
>                 od->ddev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;

I'll point out that this was introduced by:

commit c9bd0946da243a8eb86b44ff613e2c813f9b683b
Author: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Date:   Tue Jun 5 18:59:57 2018 +0200

    dmaengine: ti: omap-dma: Fix OMAP1510 incorrect residue_granularity
...
    It was verified already before that omap_get_dma_src_pos() from
    arch/arm/plat-omap/dma.c didn't work correctly for OMAP1510 - see
    commit 1bdd7419910c ("ASoC: OMAP: fix OMAP1510 broken PCM pointer
    callback") for details.  Apparently the same applies to its successor,
    omap_dma_get_src_pos() from drivers/dma/ti/omap-dma.c.

So, this now presents us with bigger problems - if we fix it now for
omap_udc, should the above commit be reverted, and if we do revert
the above commit, will it regress OMAP1510 audio.

The intention of omap-dma was always to report an accurate residue.

^ permalink raw reply

* dmaengine: ti: omap-dma: Configure LCH_TYPE for OMAP1
From: Russell King - ARM Linux @ 2018-11-25 11:11 UTC (permalink / raw)
  To: Tony Lindgren
  Cc: Aaro Koskinen, Peter Ujfalusi, vkoul, dan.j.williams, dmaengine,
	linux-kernel, linux-omap

On Sat, Nov 24, 2018 at 05:07:17PM -0800, Tony Lindgren wrote:
> * Russell King - ARM Linux <linux@armlinux.org.uk> [181124 20:10]:
> > On Fri, Nov 23, 2018 at 08:52:15PM +0200, Aaro Koskinen wrote:
> > > Hi,
> > > 
> > > On Fri, Nov 23, 2018 at 02:35:04PM +0200, Peter Ujfalusi wrote:
> > > > On 22/11/2018 17.12, Russell King - ARM Linux wrote:
> > > > > I'm also not sure about this:
> > > > > 
> > > > >         if (cpu_is_omap15xx())
> > > > >                 end++;
> > > > > 
> > > > > in dma_dest_len() - is that missing from the omap-dma driver?  It looks
> > > > > like a work-around for some problem on OMAP15xx, but I can't make sense
> > > > > about why it's in the UDC driver rather than the legacy DMA driver.
> > > > 
> > > > afaik no other legacy drivers were doing similar thing, this must be
> > > > something which is needed for the omap_udc driver to fix up something?
> > > 
> > > Here's the patch that added it: https://marc.info/?l=linux-omap&m=119634396324221&w=2
> > > 
> > > "Make DMA-OUT behave on the 1510 ... the 1510 CPC register was just
> > > off-by-one with respect to the 1611 CDAC"
> > 
> > ... which suggests that's a problem with the CPC register itself, and
> > we should fix that in the DMAengine driver rather than the USB gadget
> > driver.
> > 
> > Tony, any input on this?
> 
> Yeah that sounds like some hardware work-around for 15xx as described
> in the DMA_DEST_LAST macro reading CSAC on 15xx instead of CDAC. Seems
> like it should be done in the dmaengine driver.. My guess is that other
> dma users never needed to read CSAC register?

Hmm, reading the OMAP1510 TRM for the CPC register, it seems that
omap-dma won't handle this particularly well.  The fact that the
register only updates after the last request in an element or frame
means that if we try to use this value as the current source /
destination address before the first transfer, it can be wildly
wrong.

Saving the current value at the beginning of a request, and detecting
if it's changed (like omap_udc) isn't going to work well in the
generic case.  If, say, the register happens to contain 0x0004, and
our next transfer is using 32-bit elements in element sync mode
starting at address with lsb 16 bits as 0, it would mean we'd see
0x0004 in this register after the _second_ element has been
transferred, and we'd assume that the register hasn't yet changed -
but we would have in reality transferred two elements.

However, omap-dma.c zeros the CPC register before each transfer,
which is interesting, because in one place the OMAP1510 TRM says
that the CPC register is read/write, but in the actual description
of this register, it says it's read-only.

What it also means is that, in such a case, after the 2nd element has
been transferred, where the register contains 0x0004, the address
we'd be looking for (to calculate the residual) should be 0x0008,
not 0x0005, so we actually need to be adding the number of bytes
according to element size.

Looking at omap-dma.c, someone has added support for the residue
granularity:

        if (__dma_omap15xx(od->plat->dma_attr))
                od->ddev.residue_granularity =
                                DMA_RESIDUE_GRANULARITY_DESCRIPTOR;
        else
                od->ddev.residue_granularity = DMA_RESIDUE_GRANULARITY_BURST;

If OMAP15xx is truely descriptor granularity, then we can't use
omap-dma for omap_udc, because omap_udc needs to know exactly
how many bytes were transferred.

So... hmm, OMAP15xx DMA looks like a complete mess, and the only
way to know what would and wouldn't work is to actually have the
hardware.

I think we're better off leaving omap-udc well alone, and if it's
now broken with DMA, then that's unfortunate - it would require
someone with the hardware to diagnose the problem and fix it.  I
think trying to convert it to dmaengine would be risking way more
problems than its worth.

^ permalink raw reply

* dmaengine: ti: omap-dma: Configure LCH_TYPE for OMAP1
From: Tony Lindgren @ 2018-11-25  1:11 UTC (permalink / raw)
  To: Russell King - ARM Linux
  Cc: Aaro Koskinen, Peter Ujfalusi, vkoul, dan.j.williams, dmaengine,
	linux-kernel, linux-omap

* Tony Lindgren <tony@atomide.com> [181125 01:07]:
> * Russell King - ARM Linux <linux@armlinux.org.uk> [181124 20:10]:
> > On Fri, Nov 23, 2018 at 08:52:15PM +0200, Aaro Koskinen wrote:
> > > Hi,
> > > 
> > > On Fri, Nov 23, 2018 at 02:35:04PM +0200, Peter Ujfalusi wrote:
> > > > On 22/11/2018 17.12, Russell King - ARM Linux wrote:
> > > > > I'm also not sure about this:
> > > > > 
> > > > >         if (cpu_is_omap15xx())
> > > > >                 end++;
> > > > > 
> > > > > in dma_dest_len() - is that missing from the omap-dma driver?  It looks
> > > > > like a work-around for some problem on OMAP15xx, but I can't make sense
> > > > > about why it's in the UDC driver rather than the legacy DMA driver.
> > > > 
> > > > afaik no other legacy drivers were doing similar thing, this must be
> > > > something which is needed for the omap_udc driver to fix up something?
> > > 
> > > Here's the patch that added it: https://marc.info/?l=linux-omap&m=119634396324221&w=2
> > > 
> > > "Make DMA-OUT behave on the 1510 ... the 1510 CPC register was just
> > > off-by-one with respect to the 1611 CDAC"
> > 
> > ... which suggests that's a problem with the CPC register itself, and
> > we should fix that in the DMAengine driver rather than the USB gadget
> > driver.
> > 
> > Tony, any input on this?
> 
> Yeah that sounds like some hardware work-around for 15xx as described
> in the DMA_DEST_LAST macro reading CSAC on 15xx instead of CDAC. Seems
> like it should be done in the dmaengine driver.. My guess is that other
> dma users never needed to read CSAC register?

And it looks like for 15xx we have CPC and CSAC both at offset 0x18 in
arch/arm/mach-omap1/dma.c, seems like the dma driver is missing handling
for the CPC register that's there only for 15xx.

Regards,

Tony

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox