On Thu, 18 Jun 2020 14:21:05 +0800, 孙世龙 said: > Why does "page allocation failure" occur whereas there are still "58*4096kB > (C)"(*I think it indicates there are 58 order 10 memory could be used*) > could be used? > > Here is the related log: > > [ 2161.623563] xxxx: page allocation failure: order:10, > mode:0x2084020(GFP_ATOMIC|__GFP_COMP) Most likely, the allocation wanted some other type of allocation. The (C) on the order-10 says it's an CMA area. static const char types[MIGRATE_TYPES] = { [MIGRATE_UNMOVABLE] = 'U', [MIGRATE_MOVABLE] = 'M', [MIGRATE_RECLAIMABLE] = 'E', [MIGRATE_HIGHATOMIC] = 'H', #ifdef CONFIG_CMA [MIGRATE_CMA] = 'C', #endif #ifdef CONFIG_MEMORY_ISOLATION [MIGRATE_ISOLATE] = 'I', #endif If the call was for an unmovable, movable, reclaimable, or highatomic allocation, you lose. If you look at the source for alloc_ap_req(), you find it wants GFP_ATOMIC, not CMA. And your box is fresh out of contiguous order-10 spaces that aren't CMA, and you're down to your last 3 order-9 flagged as (UEC). I admit I find it a tad suspicious that the USB gadget driver asks for a 4M chunk of memory. Does USB actually support single transfers that large? (I'm not a USB expert)