Re: decode GFP flags in oom killer output.

From: Michal Nazarewicz
Date: Wed Mar 07 2012 - 19:18:46 EST


On Thu, 08 Mar 2012 01:04:21 +0100, Joe Perches <joe@xxxxxxxxxxx> wrote:

On Wed, 2012-03-07 at 18:39 -0500, Dave Jones wrote:
+static void decode_gfp_mask(gfp_t gfp_mask, char *out_string)
+{
+ unsigned int i;
+
+ for (i = 0; i < 32; i++) {

< sizeof(gfp_t * 8)

+ if (gfp_mask & (1 << i)) {

(gfp_t)1 << i

+ if (gfp_flag_texts[i])
+ out_string += sprintf(out_string, "%s ", gfp_flag_texts[i]);
+ else
+ out_string += sprintf(out_string, "reserved! ");

not much use to exclamation points.

+ }
+ }
+ out_string = "\0";

out_string[-1] = 0;

Will break if gfp_mask == 0.

+}
+

--
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=./ `o
..o | Computer Science, MichaÅ âmina86â Nazarewicz (o o)
ooo +----<email/xmpp: mpn@xxxxxxxxxx>--------------ooO--(_)--Ooo--
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/