Skip to contentSkip to conversation

mm: Warn about costly page allocation

PATCH Superseded Minchan Kim 4 participants 11 messages Jul 9, 2012 – Jul 11, 2012

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mm: Warn about costly page allocation

Since lumpy reclaim was introduced at 2.6.23, it helped higher order allocation.
Recently, we removed it at 3.4 and we didn't enable compaction forcingly[1]. The reason makes sense that compaction.o + migration.o isn't trivial for system doesn't use higher order allocation. But the problem is that we have to enable compaction explicitly while lumpy reclaim enabled unconditionally.

Normally, admin doesn't know his system have used higher order allocation and even lumpy reclaim have helped it.
Admin in embdded system have a tendency to minimise code size so that they can disable compaction. In this case, we can see page allocation failure we can never see in the past. It's critical on embedded side because...

Let's think this scenario.

There is QA team in embedded company and they have tested their product. In test scenario, they can allocate 100 high order allocation. (they don't matter how many high order allocations in kernel are needed during test. their concern is just only working well or fail of their middleware/application) High order allocation will be serviced well by natural buddy allocation without lumpy's help. So they released the product and sold out all over the world.
Unfortunately, in real practice, sometime, 105 high order allocation was needed rarely and fortunately, lumpy reclaim could help it so the product doesn't have a problem until now.

If they use latest kernel, they will see the new config CONFIG_COMPACTION which is very poor documentation, and they can't know it's replacement of lumpy reclaim(even, they don't know lumpy reclaim) so they simply disable that option for size optimization. Of course, QA team still test it but they can't find the problem if they don't do test stronger than old. It ends up release the product and sold out all over the world, again. But in this time, we don't have both lumpy and compaction so the problem would happen in real practice. A poor enginner from Korea have to flight to the USA for the fix a ton of products. Otherwise, should recall products from all over the world. Maybe he can lose a job. :(

This patch adds warning for notice. If the system try to allocate PAGE_ALLOC_COSTLY_ORDER above page and system enters reclaim path, it emits the warning. At least, it gives a chance to look into their system before the relase.

This patch avoids false positive by alloc_large_system_hash which allocates with GFP_ATOMIC and a fallback mechanism so it can make this warning useless.

[1] c53919ad(mm: vmscan: remove lumpy reclaim)

---
 mm/page_alloc.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
mm/page_alloc.c +16 -0
index a4d3a19..1155e00 100644
@@ -2276,6 +2276,20 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
 	return alloc_flags;
 }
 
+#if defined(CONFIG_DEBUG_VM) && !defined(CONFIG_COMPACTION)
+static inline void check_page_alloc_costly_order(unsigned int order)
+{
+	if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
+		printk_once("WARNING: You are tring to allocate %d-order page."
+		" You might need to turn on CONFIG_COMPACTION\n", order);
+	}
+}
+#else
+static inline void check_page_alloc_costly_order(unsigned int order)
+{
+}
+#endif
+
 static inline struct page *
 __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 	struct zonelist *zonelist, enum zone_type high_zoneidx,
@@ -2353,6 +2367,8 @@ rebalance:
 	if (!wait)
 		goto nopage;
 
+	check_page_alloc_costly_order(order);
+
 	/* Avoid recursion of direct reclaim */
 	if (current->flags & PF_MEMALLOC)
 		goto nopage;
Signature · 7 lines
1.7.9.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#1 lore raw
Quoted 28 lines · Minchan Kim

Since lumpy reclaim was introduced at 2.6.23, it helped higher order allocation.
Recently, we removed it at 3.4 and we didn't enable compaction forcingly[1]. The reason makes sense that compaction.o + migration.o isn't trivial for system doesn't use higher order allocation. But the problem is that we have to enable compaction explicitly while lumpy reclaim enabled unconditionally.

Normally, admin doesn't know his system have used higher order allocation and even lumpy reclaim have helped it.
Admin in embdded system have a tendency to minimise code size so that they can disable compaction. In this case, we can see page allocation failure we can never see in the past. It's critical on embedded side because...

Let's think this scenario.

There is QA team in embedded company and they have tested their product. In test scenario, they can allocate 100 high order allocation. (they don't matter how many high order allocations in kernel are needed during test. their concern is just only working well or fail of their middleware/application) High order allocation will be serviced well by natural buddy allocation without lumpy's help. So they released the product and sold out all over the world.
Unfortunately, in real practice, sometime, 105 high order allocation was needed rarely and fortunately, lumpy reclaim could help it so the product doesn't have a problem until now.

Quoted 3 lines

If they use latest kernel, they will see the new config CONFIG_COMPACTION which is very poor documentation, and they can't know it's replacement of lumpy reclaim(even, they don't know lumpy reclaim) so they simply disable

Depending on lumpy reclaim or compaction for high-order kernel allocations is dangerous. Both depend on being able to move MIGRATE_MOVABLE allocations to satisy the high-order allocation. If used regularly for high-order kernel allocations and they are long-lived, the system will eventually be unable to grant these allocations, with or without compaction or lumpy reclaim.

Be also aware that lumpy reclaim was very aggressive when reclaiming pages to satisfy an allocation. Compaction is not and compaction can be temporarily disabled if an allocation attempt fails. If lumpy reclaim was being depended upon to satisfy high-order allocations, there is no guarantee, particularly with 3.4, that compaction will succeed as it does not reclaim aggressively.

Quoted 29 lines

that option for size optimization. Of course, QA team still test it but they can't find the problem if they don't do test stronger than old. It ends up release the product and sold out all over the world, again. But in this time, we don't have both lumpy and compaction so the problem would happen in real practice. A poor enginner from Korea have to flight to the USA for the fix a ton of products. Otherwise, should recall products from all over the world. Maybe he can lose a job. :(

This patch adds warning for notice. If the system try to allocate PAGE_ALLOC_COSTLY_ORDER above page and system enters reclaim path, it emits the warning. At least, it gives a chance to look into their system before the relase.

This patch avoids false positive by alloc_large_system_hash which allocates with GFP_ATOMIC and a fallback mechanism so it can make this warning useless.

[1] c53919ad(mm: vmscan: remove lumpy reclaim)

---
 mm/page_alloc.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
mm/page_alloc.c +0 -0
index a4d3a19..1155e00 100644

mm/page_alloc.c gfp_to_alloc_flags(gfp_t gfp_mask) · line 2285

Quoted 10 lines
mm/page_alloc.c +7 -0
@@ -2276,6 +2276,20 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
 	return alloc_flags;
 }
 
+#if defined(CONFIG_DEBUG_VM) && !defined(CONFIG_COMPACTION)
+static inline void check_page_alloc_costly_order(unsigned int order)
+{
+	if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
+		printk_once("WARNING: You are tring to allocate %d-order page."
+		" You might need to turn on CONFIG_COMPACTION\n", order);
+	}

WARN_ON_ONCE would tell you what is trying to satisfy the allocation.

It should further check if this is a GFP_MOVABLE allocation or not and if not, then it should either be documented that compaction may only delay allocation failures and that they may need to consider reserving the memory in advance or doing something like forcing MIGRATE_RESERVE to only be used for high-order allocations.

Quoted 22 lines
mm/page_alloc.c +9 -0
+}
+#else
+static inline void check_page_alloc_costly_order(unsigned int order)
+{
+}
+#endif
+
 static inline struct page *
 __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 	struct zonelist *zonelist, enum zone_type high_zoneidx,
@@ -2353,6 +2367,8 @@ rebalance:
 	if (!wait)
 		goto nopage;
 
+	check_page_alloc_costly_order(order);
+
 	/* Avoid recursion of direct reclaim */
 	if (current->flags & PF_MEMALLOC)
 		goto nopage;
Signature · 1 line
1.7.9.5
Signature · 8 lines
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#2 lore raw

Hi Mel,

Quoted 33 lines · Mel Gorman
Quoted 28 lines · Minchan Kim

Since lumpy reclaim was introduced at 2.6.23, it helped higher order allocation.
Recently, we removed it at 3.4 and we didn't enable compaction forcingly[1]. The reason makes sense that compaction.o + migration.o isn't trivial for system doesn't use higher order allocation. But the problem is that we have to enable compaction explicitly while lumpy reclaim enabled unconditionally.

Normally, admin doesn't know his system have used higher order allocation and even lumpy reclaim have helped it.
Admin in embdded system have a tendency to minimise code size so that they can disable compaction. In this case, we can see page allocation failure we can never see in the past. It's critical on embedded side because...

Let's think this scenario.

There is QA team in embedded company and they have tested their product. In test scenario, they can allocate 100 high order allocation. (they don't matter how many high order allocations in kernel are needed during test. their concern is just only working well or fail of their middleware/application) High order allocation will be serviced well by natural buddy allocation without lumpy's help. So they released the product and sold out all over the world.
Unfortunately, in real practice, sometime, 105 high order allocation was needed rarely and fortunately, lumpy reclaim could help it so the product doesn't have a problem until now.

Quoted 3 lines

If they use latest kernel, they will see the new config CONFIG_COMPACTION which is very poor documentation, and they can't know it's replacement of lumpy reclaim(even, they don't know lumpy reclaim) so they simply disable

Quoted 5 lines

Depending on lumpy reclaim or compaction for high-order kernel allocations is dangerous. Both depend on being able to move MIGRATE_MOVABLE allocations to satisy the high-order allocation. If used regularly for high-order kernel allocations and they are long-lived, the system will eventually be unable to grant these allocations, with or without compaction or lumpy reclaim.

Indeed.

Quoted 6 lines

Be also aware that lumpy reclaim was very aggressive when reclaiming pages to satisfy an allocation. Compaction is not and compaction can be temporarily disabled if an allocation attempt fails. If lumpy reclaim was being depended upon to satisfy high-order allocations, there is no guarantee, particularly with 3.4, that compaction will succeed as it does not reclaim aggressively.

It's good explanation and let's add it in description.

Quoted 33 lines
Quoted 33 lines

that option for size optimization. Of course, QA team still test it but they can't find the problem if they don't do test stronger than old. It ends up release the product and sold out all over the world, again. But in this time, we don't have both lumpy and compaction so the problem would happen in real practice. A poor enginner from Korea have to flight to the USA for the fix a ton of products. Otherwise, should recall products from all over the world. Maybe he can lose a job. :(

This patch adds warning for notice. If the system try to allocate PAGE_ALLOC_COSTLY_ORDER above page and system enters reclaim path, it emits the warning. At least, it gives a chance to look into their system before the relase.

This patch avoids false positive by alloc_large_system_hash which allocates with GFP_ATOMIC and a fallback mechanism so it can make this warning useless.

[1] c53919ad(mm: vmscan: remove lumpy reclaim)

---
 mm/page_alloc.c |   16 ++++++++++++++++
 1 file changed, 16 insertions(+)
mm/page_alloc.c +0 -0
index a4d3a19..1155e00 100644
@@ -2276,6 +2276,20 @@ gfp_to_alloc_flags(gfp_t gfp_mask)
 	return alloc_flags;
 }
 
Quoted 9 lines

mm/page_alloc.c gfp_to_alloc_flags(gfp_t gfp_mask) · line 2285

Quoted 7 lines
mm/page_alloc.c +7 -0
+#if defined(CONFIG_DEBUG_VM) && !defined(CONFIG_COMPACTION)
+static inline void check_page_alloc_costly_order(unsigned int order)
+{
+	if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
+		printk_once("WARNING: You are tring to allocate %d-order page."
+		" You might need to turn on CONFIG_COMPACTION\n", order);
+	}

WARN_ON_ONCE would tell you what is trying to satisfy the allocation.

Do you mean that it would be better to use WARN_ON_ONCE rather than raw printk? If so, I would like to insist raw printk because WARN_ON_ONCE could be disabled by !CONFIG_BUG.
If I miss something, could you elaborate it more?

Quoted 6 lines

It should further check if this is a GFP_MOVABLE allocation or not and if not, then it should either be documented that compaction may only delay allocation failures and that they may need to consider reserving the memory in advance or doing something like forcing MIGRATE_RESERVE to only be used for high-order allocations.

Okay. but I got confused you want to add above description in code directly like below or write it down in comment of check_page_alloc_costly_order?

static inline void check_page_alloc_costly_order(unsigned int order, gfp_t gfp_flags)

{
       if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
               printk_once("WARNING: You are tring to allocate %d-order page."
               " You might need to turn on CONFIG_COMPACTION\n", order);
                if (gfp_flags is not GFP_MOVABLE)
                        printk_once("Compaction doesn't make sure .....\n");
       }

}

Thanks for the comment, Mel.

Quoted 33 lines
Quoted 23 lines
mm/page_alloc.c +9 -0
+}
+#else
+static inline void check_page_alloc_costly_order(unsigned int order)
+{
+}
+#endif
+
 static inline struct page *
 __alloc_pages_slowpath(gfp_t gfp_mask, unsigned int order,
 	struct zonelist *zonelist, enum zone_type high_zoneidx,
@@ -2353,6 +2367,8 @@ rebalance:
 	if (!wait)
 		goto nopage;
 
+	check_page_alloc_costly_order(order);
+
 	/* Avoid recursion of direct reclaim */
 	if (current->flags & PF_MEMALLOC)
 		goto nopage;
Signature · 1 line
1.7.9.5
Signature · 8 lines
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#3 lore raw
Quoted 11 lines · Minchan Kim
Quoted 10 lines

mm/page_alloc.c gfp_to_alloc_flags(gfp_t gfp_mask) · line 2285

Quoted 8 lines

<SNIP>

mm/page_alloc.c +7 -0
+#if defined(CONFIG_DEBUG_VM) && !defined(CONFIG_COMPACTION)
+static inline void check_page_alloc_costly_order(unsigned int order)
+{
+	if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
+		printk_once("WARNING: You are tring to allocate %d-order page."
+		" You might need to turn on CONFIG_COMPACTION\n", order);
+	}

WARN_ON_ONCE would tell you what is trying to satisfy the allocation.

Quoted 1 line

Do you mean that it would be better to use WARN_ON_ONCE rather than raw printk?

Yes.

Quoted 4 lines

If so, I would like to insist raw printk because WARN_ON_ONCE could be disabled by !CONFIG_BUG.
If I miss something, could you elaborate it more?

Ok, but all this will tell you is that *something* tried a high-order allocation. It will not tell you who and because it's a printk_once, it will also not tell you how often it's happening. You could add a dump_stack to capture that information.

Quoted 10 lines
Quoted 6 lines

It should further check if this is a GFP_MOVABLE allocation or not and if not, then it should either be documented that compaction may only delay allocation failures and that they may need to consider reserving the memory in advance or doing something like forcing MIGRATE_RESERVE to only be used for high-order allocations.

Okay. but I got confused you want to add above description in code directly like below or write it down in comment of check_page_alloc_costly_order?

You're aiming this at embedded QA people according to your changelog so do whatever you think is going to be the most effective. It's already "known" that high-order kernel allocations are meant to be unreliable and apparently this is being ignored. The in-code warning could look something like

if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
	printk_once("%s: page allocation high-order stupidity: order:%d, mode:0x%x\n",
                   current->comm, order, gfp_mask);
	if (gfp_flags & __GFP_MOVABLE) {
		printk_once("Enable compaction or whatever\n");
		dump_stack();
	} else {
		printk_once("Regular high-order kernel allocations like this will eventually start failing.");
		dump_stack();
	}
}

There should be a comment above it giving more information if you think the embedded people will actually read it. Of course, if this warning triggers during driver initialisation then it might be a completely useless. You could rate limit the warning (printk_ratelimit()) instead to be more effective. As I don't know what sort of device drivers you are seeing this problem with I can't judge what the best style of warning would be.

Signature · 8 lines
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#4 lore raw
Quoted 21 lines · Mel Gorman
Quoted 11 lines · Minchan Kim
Quoted 10 lines

mm/page_alloc.c gfp_to_alloc_flags(gfp_t gfp_mask) · line 2285

Quoted 8 lines

<SNIP>

mm/page_alloc.c +7 -0
+#if defined(CONFIG_DEBUG_VM) && !defined(CONFIG_COMPACTION)
+static inline void check_page_alloc_costly_order(unsigned int order)
+{
+	if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
+		printk_once("WARNING: You are tring to allocate %d-order page."
+		" You might need to turn on CONFIG_COMPACTION\n", order);
+	}

WARN_ON_ONCE would tell you what is trying to satisfy the allocation.

Quoted 1 line

Do you mean that it would be better to use WARN_ON_ONCE rather than raw printk?

Yes.

Quoted 4 lines

If so, I would like to insist raw printk because WARN_ON_ONCE could be disabled by !CONFIG_BUG.
If I miss something, could you elaborate it more?

Quoted 4 lines

Ok, but all this will tell you is that *something* tried a high-order allocation. It will not tell you who and because it's a printk_once, it will also not tell you how often it's happening. You could add a dump_stack to capture that information.

That's a good idea.

Quoted 18 lines
Quoted 11 lines
Quoted 7 lines

It should further check if this is a GFP_MOVABLE allocation or not and if not, then it should either be documented that compaction may only delay allocation failures and that they may need to consider reserving the memory in advance or doing something like forcing MIGRATE_RESERVE to only be used for high-order allocations.

Okay. but I got confused you want to add above description in code directly like below or write it down in comment of check_page_alloc_costly_order?

You're aiming this at embedded QA people according to your changelog so do whatever you think is going to be the most effective. It's already "known" that high-order kernel allocations are meant to be unreliable and apparently this is being ignored. The in-code warning could look something like

Quoted 11 lines
if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
	printk_once("%s: page allocation high-order stupidity: order:%d, mode:0x%x\n",
                   current->comm, order, gfp_mask);
	if (gfp_flags & __GFP_MOVABLE) {
		printk_once("Enable compaction or whatever\n");
		dump_stack();
	} else {
		printk_once("Regular high-order kernel allocations like this will eventually start failing.");
		dump_stack();
	}
}

I'm not sure we have to check further for __GFP_MOVABLE because I have not seen driver uses __GFP_MOVABLE for high order allocation. Although it uses the flag, it's never compactable since it's out of LRU list. So I think it's rather overkill.

Quoted 7 lines

There should be a comment above it giving more information if you think the embedded people will actually read it. Of course, if this warning triggers during driver initialisation then it might be a completely useless. You could rate limit the warning (printk_ratelimit()) instead to be more effective. As I don't know what sort of device drivers you are seeing this problem with I can't judge what the best style of warning would be.

Okay.
I will send patch like below tomorrow if there isn't any objection.

if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
	if (printk_ratelimit()) {
		printk("%s: page allocation high-order stupidity: order:%d, mode:0x%x\n",
			current->comm, order, gfp_mask);
		printk_once("Enable compaction or whatever\n");
		printk_once("Regular high-order kernel allocations like this will eventually start failing.\n");
		dump_stack();
	}
}
Quoted 4 lines
Signature · 3 lines
-- 
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#5 lore raw
Quoted 20 lines · Minchan Kim
Quoted 8 lines

<SNIP>

You're aiming this at embedded QA people according to your changelog so do whatever you think is going to be the most effective. It's already "known" that high-order kernel allocations are meant to be unreliable and apparently this is being ignored. The in-code warning could look something like

Quoted 11 lines
if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
	printk_once("%s: page allocation high-order stupidity: order:%d, mode:0x%x\n",
                   current->comm, order, gfp_mask);
	if (gfp_flags & __GFP_MOVABLE) {
		printk_once("Enable compaction or whatever\n");
		dump_stack();
	} else {
		printk_once("Regular high-order kernel allocations like this will eventually start failing.");
		dump_stack();
	}
}
Quoted 4 lines

I'm not sure we have to check further for __GFP_MOVABLE because I have not seen driver uses __GFP_MOVABLE for high order allocation. Although it uses the flag, it's never compactable since it's out of LRU list. So I think it's rather overkill.

Then I would have considered it even more important to warn them that their specific usage is going to break eventually, with or without compaction. However, you know the target audience for this warning so it's your call.

Quoted 11 lines
Quoted 7 lines

There should be a comment above it giving more information if you think the embedded people will actually read it. Of course, if this warning triggers during driver initialisation then it might be a completely useless. You could rate limit the warning (printk_ratelimit()) instead to be more effective. As I don't know what sort of device drivers you are seeing this problem with I can't judge what the best style of warning would be.

Okay.
I will send patch like below tomorrow if there isn't any objection.

Quoted 9 lines
if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
	if (printk_ratelimit()) {
		printk("%s: page allocation high-order stupidity: order:%d, mode:0x%x\n",
			current->comm, order, gfp_mask);
		printk_once("Enable compaction or whatever\n");
		printk_once("Regular high-order kernel allocations like this will eventually start failing.\n");
		dump_stack();
	}
}

The warning message could be improved. I did not expect you to use "Enable compaction or whatever" verbatim. I was just illustrating what type of warnings I thought might be useful. I expected you would change it to something that embedded driver authors would pay attention to :)

As you are using printk_ratelimit(), you can also use pr_warning to annotate this as KERN_WARNING.

Signature · 8 lines
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to [email protected].  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
#6 lore raw
Quoted 26 lines · Mel Gorman
Quoted 20 lines · Minchan Kim
Quoted 8 lines

<SNIP>

You're aiming this at embedded QA people according to your changelog so do whatever you think is going to be the most effective. It's already "known" that high-order kernel allocations are meant to be unreliable and apparently this is being ignored. The in-code warning could look something like

Quoted 11 lines
if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
	printk_once("%s: page allocation high-order stupidity: order:%d, mode:0x%x\n",
                   current->comm, order, gfp_mask);
	if (gfp_flags & __GFP_MOVABLE) {
		printk_once("Enable compaction or whatever\n");
		dump_stack();
	} else {
		printk_once("Regular high-order kernel allocations like this will eventually start failing.");
		dump_stack();
	}
}
Quoted 4 lines

I'm not sure we have to check further for __GFP_MOVABLE because I have not seen driver uses __GFP_MOVABLE for high order allocation. Although it uses the flag, it's never compactable since it's out of LRU list. So I think it's rather overkill.

Quoted 22 lines

Then I would have considered it even more important to warn them that their specific usage is going to break eventually, with or without compaction. However, you know the target audience for this warning so it's your call.

Quoted 17 lines
Quoted 7 lines

There should be a comment above it giving more information if you think the embedded people will actually read it. Of course, if this warning triggers during driver initialisation then it might be a completely useless. You could rate limit the warning (printk_ratelimit()) instead to be more effective. As I don't know what sort of device drivers you are seeing this problem with I can't judge what the best style of warning would be.

Okay.
I will send patch like below tomorrow if there isn't any objection.

if (unlikely(order > PAGE_ALLOC_COSTLY_ORDER)) {
	if (printk_ratelimit()) {
		printk("%s: page allocation high-order stupidity: order:%d, mode:0x%x\n",
			current->comm, order, gfp_mask);
		printk_once("Enable compaction or whatever\n");
		printk_once("Regular high-order kernel allocations like this will eventually start failing.\n");

s/printk_once/printk/g
Copy&Paste should go away. :(

Quoted 8 lines
Quoted 3 lines
		dump_stack();
	}
}

The warning message could be improved. I did not expect you to use "Enable compaction or whatever" verbatim. I was just illustrating what type of warnings I thought might be useful. I expected you would change it to something that embedded driver authors would pay attention to :)

Okay.

Quoted 3 lines

As you are using printk_ratelimit(), you can also use pr_warning to annotate this as KERN_WARNING.

Will do.
Thanks, Mel.

Quoted 4 lines
Signature · 3 lines
-- 
Mel Gorman
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

maintainer
#7 lore raw
Quoted 1 line · On Mon, 9 Jul 2012 22:19:42 +0900 Minchan Kim <[email protected]> wrote:
Quoted 1 line

As you are using printk_ratelimit()

include/linux/printk.h sayeth

/*
* Please don't use printk_ratelimit(), because it shares ratelimiting state
* with all other unrelated printk_ratelimit() callsites. Instead use
* printk_ratelimited() or plain old __ratelimit().
*/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#8 lore raw
In reply to Minchan Kim
Quoted 8 lines · Minchan Kim
Quoted 2 lines

WARN_ON_ONCE would tell you what is trying to satisfy the allocation.

Do you mean that it would be better to use WARN_ON_ONCE rather than raw printk? If so, I would like to insist raw printk because WARN_ON_ONCE could be disabled by !CONFIG_BUG.
If I miss something, could you elaborate it more?

Raw printk could be disabled by !CONFIG_PRINTK too, and given that:

config PRINTK
default y
bool "Enable support for printk" if EXPERT

config BUG
bool "BUG() support" if EXPERT
default y

they are both configurable only when ERPERT, so we don't need to worry much. :)

#9 lore raw

Hi Cong,

Quoted 11 lines · Cong Wang
Quoted 8 lines · Minchan Kim
Quoted 2 lines

WARN_ON_ONCE would tell you what is trying to satisfy the allocation.

Do you mean that it would be better to use WARN_ON_ONCE rather than raw printk? If so, I would like to insist raw printk because WARN_ON_ONCE could be disabled by !CONFIG_BUG.
If I miss something, could you elaborate it more?

Raw printk could be disabled by !CONFIG_PRINTK too, and given that:

Yes.
In such case, It is very hard to diagnose the system so at least we enables CONFIG_PRINTK.

Quoted 11 lines

config PRINTK
default y
bool "Enable support for printk" if EXPERT

config BUG
bool "BUG() support" if EXPERT
default y

they are both configurable only when ERPERT, so we don't need to worry much. :)

Embedded can use CONFIG_PRINTK and !CONFIG_BUG for size optimization and printk(pr_xxx) + dump_stack is common technic used in all over kernel sources. Do you have any reason you don't like it?

Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#10 lore raw
Quoted 5 lines · Minchan Kim

Embedded can use CONFIG_PRINTK and !CONFIG_BUG for size optimization and printk(pr_xxx) + dump_stack is common technic used in all over kernel sources. Do you have any reason you don't like it?

No, I am just feeling like it is a kind of dup. No objections from me.

Thanks.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>