mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* FW: Page Allocation Failure, Why?? Bug in kernel??
@ 2006-06-01  9:37 Abu M. Muttalib
  2006-06-01 10:03 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: Abu M. Muttalib @ 2006-06-01  9:37 UTC (permalink / raw)
  To: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1751 bytes --]

Hi,

I tried to run an application, try-sound.c. In the course of the run of the
application I repeatedly got page allocation failure, despite the fact that
enough pages are free. Why this is so, is it a bug in mm subsystem of Linux
kernel 2.6.13?

The Page allocation failure is as follows:

insmod: page allocation failure. order:5, mode:0xd0
Mem-info:
DMA per-cpu:
cpu 0 hot: low 2, high 6, batch 1 used:5
cpu 0 cold: low 0, high 2, batch 1 used:1
Normal per-cpu: empty
HighMem per-cpu: empty
Free pages:         944kB (0kB HighMem)
Active:1611 inactive:279 dirty:0 writeback:0 unstable:0 free:236 slab:483
mapped:1378 pagetables:43
DMA free:944kB min:512kB low:640kB high:768kB active:6444kB inactive:1116kB
present:16384kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 0
Normal free:0kB min:0kB low:0kB high:0kB active:0kB inactive:0kB present:0kB
pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 0
HighMem free:0kB min:128kB low:160kB high:192kB active:0kB inactive:0kB
present:0kB pages_scanned:0 all_unreclaimable? no
lowmem_reserve[]: 0 0 0
DMA: 106*4kB 11*8kB 5*16kB 3*32kB 2*64kB 1*128kB 0*256kB 0*512kB 0*1024kB =
944kB
Normal: empty
HighMem: empty
Swap cache: add 0, delete 0, find 0/0, race 0+0
Free swap  = 0kB
Total swap = 0kB
Free swap:            0kB
4096 pages of RAM
450 free pages
593 reserved pages
483 slab pages
291 pages shared
0 pages swap cached

Before this failure the /proc/buddyinfo is as follows:

Node 0, zone      DMA     43      5      5      3      2      2      0
0      0

After the failure the /proc/buddyinfo is as follows:

Node 0, zone      DMA     77     13      5      3      2      2      0
0      0

Any pointer to help understand this behavior will be highly appreciated.

~Abu.

[-- Attachment #2: try-sound.c --]
[-- Type: application/octet-stream, Size: 7611 bytes --]

#include <stdio.h>
#include <malloc.h>
#include <fcntl.h>

// YoKu 20-10-04 for PMU
#include <linux/i2c.h>
#include <linux/i2c-dev.h>
// YoKu


#define PAGES 900
#define SIGPAGE 4096 
#define REFERESH 0
// LCD                          VDIG_1
#define LCD                     2    

// LCD_BACKLIGHT                CURR1
#define LCD_BACKLIGHT           3       
#define I2C_DEV 		"/dev/i2c-0"	// I2C Device File
#define PMU_CHARGER		"/dev/PMU_CHARGER"
#define WAVE_PIPE		"/tmp/WAVE_PIPE"
#define PMU_ADDR                0x41            // PMU Write Address
#define POWER_CONTROL           9
#define ON           1
#define OFF          0
#define LCD_ON_MASK                     0x04            // 0000 0100    POWER_CONTROL
#define LCD_BACKLIGHT_ON_MASK           0x04            // 0000 0100    CURR_CONTROL
#define CURR_CONTROL            40
#define CURR_MODE		41


int fdI2C;
unsigned char gbyLCDBackOn = 1;

fn_SwitchDev(unsigned char byDev, unsigned char byOp)
{
	__s16  byPresent_val;

	 if ( byDev == LCD )
        {
                if( (byPresent_val = i2c_smbus_read_byte_data(fdI2C , POWER_CONTROL)) < 0) 
		{
		       perror("\nfn_SwitchDev: I2C POWER_CONTROL Read Fail") ;
		}
                else
                {
                        if ( byOp == ON )
			{
                                byPresent_val |= LCD_ON_MASK;
#ifdef MAIN_DEBUG
				printf("\nPMU: Switching LCD ON");
#endif
			}
                        else
			{
                                byPresent_val &= ~LCD_ON_MASK;
#ifdef MAIN_DEBUG
				printf("\nPMU: Switching LCD OFF");
#endif
			}
                        if(i2c_smbus_write_byte_data( fdI2C, POWER_CONTROL, byPresent_val ) < 0) 
			{
			         perror("\nfn_SwitchDev: I2C POWER_CONTROL write Fail") ;
			}
                }
        }
	else if ( byDev == LCD_BACKLIGHT )
	{
		if( (byPresent_val = i2c_smbus_read_byte_data( fdI2C , CURR_CONTROL )) < 0)
		{
			perror("\nfn_SwitchDev: I2C CURR_CONTROL Read Fail") ;
		}
		else
		{
			//pthread_mutex_lock(&_mutgbyLCDBackOn);
			if ( byOp == ON )
			{
				byPresent_val |= LCD_BACKLIGHT_ON_MASK;
#ifdef MAIN_DEBUG
				printf("\nPMU: Switching LCD BACKLIGHT ON");
#endif
				if(i2c_smbus_write_byte_data( fdI2C, CURR_CONTROL, byPresent_val ) < 0)
                                	perror("\nfn_SwitchDev: I2C CURR_CONTROL write Fail") ;
				else
					gbyLCDBackOn = 1;
			}
			else
			{
				byPresent_val &= ~LCD_BACKLIGHT_ON_MASK;
#ifdef MAIN_DEBUG
				printf("\nPMU: Switching LCD BACKLIGHT OFF");
#endif
				if(i2c_smbus_write_byte_data( fdI2C, CURR_CONTROL, byPresent_val ) < 0)
                                	perror("\nfn_SwitchDev: I2C CURR_CONTROL write Fail") ;
				else
					gbyLCDBackOn = 0;
			}
			//pthread_mutex_unlock(&_mutgbyLCDBackOn);
		}
	}
}

int main()
{
	int i=-1;
	static unsigned int cntr = 0 ;
	char *poarray,*p2=NULL;

	system("cat /proc/meminfo");
	for (i=0;i<PAGES;i++)
	{
		poarray=(char*)malloc(SIGPAGE);
		memset(poarray, '\0', SIGPAGE);	
		if(poarray==NULL)
		{
			printf("\nError in allocating\n");
			exit(1);
		}
	}

	if( (fdI2C = open(I2C_DEV,O_RDWR)) < 0 )                // Open I2C Device
        {
                perror("\nMAIN: Cannot open I2C device\n") ;
        }
	else
	{
		// Write 'PMU Write addr' to I2C Device
	        if (ioctl(fdI2C,I2C_SLAVE,PMU_ADDR) < 0)
        	{
                	perror("\nMAIN: I2C PMU_ADDR Write Fail");
        	}
       		 printf("\nMAIN: I2C PMU_ADDR Write Success.fdI2c = %d" ,fdI2C );
	}

	fn_SwitchDev(LCD, 1);
	fn_SwitchDev(LCD_BACKLIGHT, 1);


	while(1)
	{
		cntr ++ ;
		fn_SwitchDev(LCD_BACKLIGHT, 0);
		printf("\nREMOVING MODULES Ittr=%d \n" , cntr);
		sleep(REFERESH);
		system("cat /proc/meminfo");
		system("cat /proc/buddyinfo");
		sleep(REFERESH);
		system("rmmod snd-pcm-oss");
		sleep(REFERESH);
		system("cat /proc/meminfo");
		system("cat /proc/buddyinfo");
		sleep(REFERESH);
		system("rmmod snd-mixer-oss");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("rmmod snd-pxa2xx-ac97");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("rmmod snd-pxa2xx-pcm");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("rmmod snd-ac97-codec");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("rmmod snd-pcm");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("rmmod snd-page-alloc");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("rmmod snd-timer");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("rmmod snd");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("rmmod soundcore");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);

		sleep(2);
		fn_SwitchDev(LCD_BACKLIGHT, 1);
        	p2=(char*)malloc(100);
        	if(p2 == NULL)
        	{
        		printf("OOM PROBLEM");
	        }   
 
		system("lsmod");
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");

//		system("echo 150 >/proc/sys/pm/suspend");

		system("cat /proc/meminfo");

		printf("\nInserting Modules\n");
		system("/sbin/insmod /lib/modules/2.6.13/alsa/soundcore.ko");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("/sbin/insmod /lib/modules/2.6.13/alsa/snd.ko");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("/sbin/insmod /lib/modules/2.6.13/alsa/snd-timer.ko");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("/sbin/insmod /lib/modules/2.6.13/alsa/snd-page-alloc.ko");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("/sbin/insmod /lib/modules/2.6.13/alsa/snd-pcm.ko");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("/sbin/insmod /lib/modules/2.6.13/alsa/snd-ac97-codec.ko");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("/sbin/insmod /lib/modules/2.6.13/alsa/snd-pxa2xx-pcm.ko");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("/sbin/insmod /lib/modules/2.6.13/alsa/snd-pxa2xx-ac97.ko");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("/sbin/insmod /lib/modules/2.6.13/alsa/snd-mixer-oss.ko");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");
		sleep(REFERESH);
		system("/sbin/insmod /lib/modules/2.6.13/alsa/snd-pcm-oss.ko");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("rmmod linuxdrv");
		sleep(REFERESH);
		system("cat /proc/buddyinfo");
		system("cat /proc/meminfo");

		system("/sbin/insmod /root/linuxdrv.ko");
		system("cat /proc/meminfo");
		system("lsmod");
		system("cat /proc/buddyinfo");
		sleep(REFERESH);
		free(p2);
		p2 = NULL;
	}
}

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-01  9:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-06-01  9:37 FW: Page Allocation Failure, Why?? Bug in kernel?? Abu M. Muttalib
2006-06-01 10:03 ` Andrew Morton

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

all inboxes | Powered by JetHome®