aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNamhoon Kim <namhoonk@cs.unc.edu>2018-02-07 22:13:48 -0500
committerNamhoon Kim <namhoonk@cs.unc.edu>2018-02-07 22:13:48 -0500
commit2dd395b092b13e26aaa7a1ce8795be7b6d4a24c9 (patch)
treefdceed279e9516d7a69b06ac47a670729ac558b7
parentbda9461f8f90ed9ae69a57a797daed44340c8484 (diff)
IPC supports
-rw-r--r--arch/arm/mm/dma-mapping.c2
-rw-r--r--drivers/media/usb/uvc/uvc_video.c7
-rw-r--r--drivers/media/v4l2-core/videobuf2-core.c9
-rw-r--r--drivers/media/v4l2-core/videobuf2-vmalloc.c5
-rw-r--r--drivers/net/ethernet/freescale/fec_main.c2
-rw-r--r--drivers/usb/core/urb.c10
-rw-r--r--include/linux/msg.h2
-rw-r--r--include/litmus/cache_proc.h4
-rw-r--r--ipc/mqueue.c2
-rw-r--r--ipc/msg.c14
-rw-r--r--ipc/msgutil.c68
-rw-r--r--ipc/util.h2
-rw-r--r--kernel/softirq.c11
-rw-r--r--litmus/bank_proc.c12
-rw-r--r--litmus/cache_proc.c82
-rw-r--r--litmus/litmus.c38
-rw-r--r--mm/page_alloc.c4
-rw-r--r--mm/slab_common.c9
-rw-r--r--mm/vmalloc.c2
-rw-r--r--net/core/dev.c29
-rw-r--r--net/core/skbuff.c42
21 files changed, 273 insertions, 83 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index bd7dfb1b7ebd..b27199c9ae15 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -260,7 +260,7 @@ static struct page *__dma_alloc_buffer(struct device *dev, size_t size, gfp_t gf
260 if (!page) 260 if (!page)
261 return NULL; 261 return NULL;
262 if (gfp&GFP_COLOR) 262 if (gfp&GFP_COLOR)
263 printk(KERN_INFO "__dma_alloc_buffer(): size %d, order %ld requested\n", size, order); 263 //printk(KERN_INFO "__dma_alloc_buffer(): size %d, order %ld requested\n", size, order);
264 /* 264 /*
265 * Now split the huge page and free the excess pages 265 * Now split the huge page and free the excess pages
266 */ 266 */
diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index 9daef917557b..3dd00a6b51fe 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -26,7 +26,7 @@
26 26
27#include "uvcvideo.h" 27#include "uvcvideo.h"
28 28
29#define ENABLE_WORST_CASE 1 29//#define ENABLE_WORST_CASE 1
30#ifdef ENABLE_WORST_CASE 30#ifdef ENABLE_WORST_CASE
31#define UVC_FLAG (GFP_COLOR|GFP_CPU1) 31#define UVC_FLAG (GFP_COLOR|GFP_CPU1)
32#else 32#else
@@ -343,6 +343,7 @@ int uvc_probe_video(struct uvc_streaming *stream,
343 break; 343 break;
344 344
345 if (stream->dev->quirks & UVC_QUIRK_PROBE_MINMAX) { 345 if (stream->dev->quirks & UVC_QUIRK_PROBE_MINMAX) {
346 printk(KERN_INFO "uvc_probe_video(): no space error\n");
346 ret = -ENOSPC; 347 ret = -ENOSPC;
347 goto done; 348 goto done;
348 } 349 }
@@ -1619,6 +1620,7 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags)
1619 1620
1620 /* Isochronous endpoint, select the alternate setting. */ 1621 /* Isochronous endpoint, select the alternate setting. */
1621 bandwidth = stream->ctrl.dwMaxPayloadTransferSize; 1622 bandwidth = stream->ctrl.dwMaxPayloadTransferSize;
1623 //bandwidth = 1;
1622 1624
1623 if (bandwidth == 0) { 1625 if (bandwidth == 0) {
1624 uvc_trace(UVC_TRACE_VIDEO, "Device requested null " 1626 uvc_trace(UVC_TRACE_VIDEO, "Device requested null "
@@ -1656,7 +1658,8 @@ static int uvc_init_video(struct uvc_streaming *stream, gfp_t gfp_flags)
1656 1658
1657 uvc_trace(UVC_TRACE_VIDEO, "Selecting alternate setting %u " 1659 uvc_trace(UVC_TRACE_VIDEO, "Selecting alternate setting %u "
1658 "(%u B/frame bandwidth).\n", altsetting, best_psize); 1660 "(%u B/frame bandwidth).\n", altsetting, best_psize);
1659 1661 printk(KERN_INFO "Selecting alternate setting %u "
1662 "(%u B/frame bandwidth).\n", altsetting, best_psize);
1660 ret = usb_set_interface(stream->dev->udev, intfnum, altsetting); 1663 ret = usb_set_interface(stream->dev->udev, intfnum, altsetting);
1661 if (ret < 0) 1664 if (ret < 0)
1662 return ret; 1665 return ret;
diff --git a/drivers/media/v4l2-core/videobuf2-core.c b/drivers/media/v4l2-core/videobuf2-core.c
index 54058877f467..0447135e89f1 100644
--- a/drivers/media/v4l2-core/videobuf2-core.c
+++ b/drivers/media/v4l2-core/videobuf2-core.c
@@ -30,7 +30,7 @@
30#include <media/v4l2-common.h> 30#include <media/v4l2-common.h>
31#include <media/videobuf2-core.h> 31#include <media/videobuf2-core.h>
32 32
33#define ENABLE_WORST_CASE 1 33//#define ENABLE_WORST_CASE 1
34#ifdef ENABLE_WORST_CASE 34#ifdef ENABLE_WORST_CASE
35#define VB2_CORE_FLAG (GFP_COLOR|GFP_CPU1) 35#define VB2_CORE_FLAG (GFP_COLOR|GFP_CPU1)
36#else 36#else
@@ -207,9 +207,9 @@ static int __vb2_buf_mem_alloc(struct vb2_buffer *vb)
207 */ 207 */
208 for (plane = 0; plane < vb->num_planes; ++plane) { 208 for (plane = 0; plane < vb->num_planes; ++plane) {
209 unsigned long size = PAGE_ALIGN(q->plane_sizes[plane]); 209 unsigned long size = PAGE_ALIGN(q->plane_sizes[plane]);
210 printk(KERN_INFO "__vb2_buf_mem_alloc(): size %ld, func %pF GFP_COLOR? %d\n", size, vb->vb2_queue->mem_ops->alloc, q->gfp_flags&GFP_COLOR); 210 printk(KERN_INFO "__vb2_buf_mem_alloc(): size %ld, func %pF GFP_COLOR? %d\n", size, vb->vb2_queue->mem_ops->alloc, q->gfp_flags|VB2_CORE_FLAG);
211 mem_priv = call_ptr_memop(vb, alloc, q->alloc_ctx[plane], 211 mem_priv = call_ptr_memop(vb, alloc, q->alloc_ctx[plane],
212 size, dma_dir, q->gfp_flags); 212 size, dma_dir, q->gfp_flags|VB2_CORE_FLAG);
213 if (IS_ERR_OR_NULL(mem_priv)) 213 if (IS_ERR_OR_NULL(mem_priv))
214 goto free; 214 goto free;
215 215
@@ -1783,8 +1783,10 @@ static int vb2_start_streaming(struct vb2_queue *q)
1783 1783
1784 /* Tell the driver to start streaming */ 1784 /* Tell the driver to start streaming */
1785 q->start_streaming_called = 1; 1785 q->start_streaming_called = 1;
1786 printk(KERN_INFO "vb2_start_streaming(): %pF\n", q->ops->start_streaming);
1786 ret = call_qop(q, start_streaming, q, 1787 ret = call_qop(q, start_streaming, q,
1787 atomic_read(&q->owned_by_drv_count)); 1788 atomic_read(&q->owned_by_drv_count));
1789 printk(KERN_INFO "vb2_start_streaming() : ret1 = %d\n", ret);
1788 if (!ret) 1790 if (!ret)
1789 return 0; 1791 return 0;
1790 1792
@@ -1818,6 +1820,7 @@ static int vb2_start_streaming(struct vb2_queue *q)
1818 * STATE_DONE. 1820 * STATE_DONE.
1819 */ 1821 */
1820 WARN_ON(!list_empty(&q->done_list)); 1822 WARN_ON(!list_empty(&q->done_list));
1823 printk(KERN_INFO "vb2_start_streaming() : ret2 = %d\n", ret);
1821 return ret; 1824 return ret;
1822} 1825}
1823 1826
diff --git a/drivers/media/v4l2-core/videobuf2-vmalloc.c b/drivers/media/v4l2-core/videobuf2-vmalloc.c
index 813cc718c116..97ff2c45b8b2 100644
--- a/drivers/media/v4l2-core/videobuf2-vmalloc.c
+++ b/drivers/media/v4l2-core/videobuf2-vmalloc.c
@@ -21,14 +21,13 @@
21#include <media/videobuf2-vmalloc.h> 21#include <media/videobuf2-vmalloc.h>
22#include <media/videobuf2-memops.h> 22#include <media/videobuf2-memops.h>
23 23
24 24//#define ENABLE_WORST_CASE 1
25#define ENABLE_WORST_CASE 1
26#ifdef ENABLE_WORST_CASE 25#ifdef ENABLE_WORST_CASE
27#define VB2_FLAG (GFP_COLOR|GFP_CPU1) 26#define VB2_FLAG (GFP_COLOR|GFP_CPU1)
28#else 27#else
29#define VB2_FLAG (GFP_COLOR) 28#define VB2_FLAG (GFP_COLOR)
30#endif 29#endif
31 30
32struct vb2_vmalloc_buf { 31struct vb2_vmalloc_buf {
33 void *vaddr; 32 void *vaddr;
34 struct page **pages; 33 struct page **pages;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 2f7aab0b60cf..faaea8abddd0 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -65,7 +65,7 @@
65 65
66#include "fec.h" 66#include "fec.h"
67 67
68#define ENABLE_WORST_CASE 1 68//#define ENABLE_WORST_CASE 1
69#ifdef ENABLE_WORST_CASE 69#ifdef ENABLE_WORST_CASE
70#define FEC_FLAG (GFP_COLOR|GFP_CPU1) 70#define FEC_FLAG (GFP_COLOR|GFP_CPU1)
71#else 71#else
diff --git a/drivers/usb/core/urb.c b/drivers/usb/core/urb.c
index c9e8ee81b6b7..468334a94b41 100644
--- a/drivers/usb/core/urb.c
+++ b/drivers/usb/core/urb.c
@@ -10,6 +10,12 @@
10 10
11#define to_urb(d) container_of(d, struct urb, kref) 11#define to_urb(d) container_of(d, struct urb, kref)
12 12
13//#define ENABLE_WORST_CASE 1
14#ifdef ENABLE_WORST_CASE
15#define URB_FLAG (GFP_COLOR|GFP_CPU1)
16#else
17#define URB_FLAG (GFP_COLOR)
18#endif
13 19
14static void urb_destroy(struct kref *kref) 20static void urb_destroy(struct kref *kref)
15{ 21{
@@ -67,7 +73,7 @@ struct urb *usb_alloc_urb(int iso_packets, gfp_t mem_flags)
67 73
68 urb = kmalloc(sizeof(struct urb) + 74 urb = kmalloc(sizeof(struct urb) +
69 iso_packets * sizeof(struct usb_iso_packet_descriptor), 75 iso_packets * sizeof(struct usb_iso_packet_descriptor),
70 mem_flags); 76 mem_flags|URB_FLAG);
71 if (!urb) { 77 if (!urb) {
72 printk(KERN_ERR "alloc_urb: kmalloc failed\n"); 78 printk(KERN_ERR "alloc_urb: kmalloc failed\n");
73 return NULL; 79 return NULL;
@@ -539,7 +545,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
539 } 545 }
540 } 546 }
541 547
542 return usb_hcd_submit_urb(urb, mem_flags); 548 return usb_hcd_submit_urb(urb, mem_flags|URB_FLAG);
543} 549}
544EXPORT_SYMBOL_GPL(usb_submit_urb); 550EXPORT_SYMBOL_GPL(usb_submit_urb);
545 551
diff --git a/include/linux/msg.h b/include/linux/msg.h
index f3f302f9c197..9bf01c93f56e 100644
--- a/include/linux/msg.h
+++ b/include/linux/msg.h
@@ -12,6 +12,8 @@ struct msg_msg {
12 struct msg_msgseg *next; 12 struct msg_msgseg *next;
13 void *security; 13 void *security;
14 /* the actual message follows immediately */ 14 /* the actual message follows immediately */
15 dma_addr_t handle;
16 size_t alloc_len;
15}; 17};
16 18
17/* one msq_queue structure for each present queue on the system */ 19/* one msq_queue structure for each present queue on the system */
diff --git a/include/litmus/cache_proc.h b/include/litmus/cache_proc.h
index e9440de504fc..1d9d443da3db 100644
--- a/include/litmus/cache_proc.h
+++ b/include/litmus/cache_proc.h
@@ -8,9 +8,13 @@ void enter_irq_mode(void);
8void exit_irq_mode(void); 8void exit_irq_mode(void);
9void flush_cache(int all); 9void flush_cache(int all);
10void lock_cache(int cpu, u32 val); 10void lock_cache(int cpu, u32 val);
11void cache_lockdown(u32 lock_val, int cpu);
11 12
12extern struct page *new_alloc_page_color(unsigned long color); 13extern struct page *new_alloc_page_color(unsigned long color);
13 14
15u32 color_read_in_mem_lock(u32 lock_val, u32 unlock_val, void *start, void *end);
16u32 color_read_in_mem(u32 lock_val, u32 unlock_val, void *start, void *end);
17
14#endif 18#endif
15 19
16#endif 20#endif
diff --git a/ipc/mqueue.c b/ipc/mqueue.c
index 3aaea7ffd077..4cb1b7f0dcbf 100644
--- a/ipc/mqueue.c
+++ b/ipc/mqueue.c
@@ -1004,7 +1004,7 @@ SYSCALL_DEFINE5(mq_timedsend, mqd_t, mqdes, const char __user *, u_msg_ptr,
1004 1004
1005 /* First try to allocate memory, before doing anything with 1005 /* First try to allocate memory, before doing anything with
1006 * existing queues. */ 1006 * existing queues. */
1007 msg_ptr = load_msg(u_msg_ptr, msg_len); 1007 msg_ptr = load_msg(u_msg_ptr, msg_len, 0);
1008 if (IS_ERR(msg_ptr)) { 1008 if (IS_ERR(msg_ptr)) {
1009 ret = PTR_ERR(msg_ptr); 1009 ret = PTR_ERR(msg_ptr);
1010 goto out_fput; 1010 goto out_fput;
diff --git a/ipc/msg.c b/ipc/msg.c
index 2b6fdbb9e0e9..b874d700023f 100644
--- a/ipc/msg.c
+++ b/ipc/msg.c
@@ -38,6 +38,10 @@
38#include <linux/nsproxy.h> 38#include <linux/nsproxy.h>
39#include <linux/ipc_namespace.h> 39#include <linux/ipc_namespace.h>
40 40
41#include <litmus/trace.h>
42#include <litmus/litmus.h>
43#include <asm/cacheflush.h>
44
41#include <asm/current.h> 45#include <asm/current.h>
42#include <linux/uaccess.h> 46#include <linux/uaccess.h>
43#include "util.h" 47#include "util.h"
@@ -619,7 +623,7 @@ long do_msgsnd(int msqid, long mtype, void __user *mtext,
619 if (mtype < 1) 623 if (mtype < 1)
620 return -EINVAL; 624 return -EINVAL;
621 625
622 msg = load_msg(mtext, msgsz); 626 msg = load_msg(mtext, msgsz, mtype);
623 if (IS_ERR(msg)) 627 if (IS_ERR(msg))
624 return PTR_ERR(msg); 628 return PTR_ERR(msg);
625 629
@@ -752,13 +756,13 @@ static long do_msg_fill(void __user *dest, struct msg_msg *msg, size_t bufsz)
752{ 756{
753 struct msgbuf __user *msgp = dest; 757 struct msgbuf __user *msgp = dest;
754 size_t msgsz; 758 size_t msgsz;
755
756 if (put_user(msg->m_type, &msgp->mtype)) 759 if (put_user(msg->m_type, &msgp->mtype))
757 return -EFAULT; 760 return -EFAULT;
758
759 msgsz = (bufsz > msg->m_ts) ? msg->m_ts : bufsz; 761 msgsz = (bufsz > msg->m_ts) ? msg->m_ts : bufsz;
762
760 if (store_msg(msgp->mtext, msg, msgsz)) 763 if (store_msg(msgp->mtext, msg, msgsz))
761 return -EFAULT; 764 return -EFAULT;
765
762 return msgsz; 766 return msgsz;
763} 767}
764 768
@@ -976,10 +980,10 @@ out_unlock1:
976 free_copy(copy); 980 free_copy(copy);
977 return PTR_ERR(msg); 981 return PTR_ERR(msg);
978 } 982 }
979 983TS_NET_RX_HARDIRQ_START;
980 bufsz = msg_handler(buf, msg, bufsz); 984 bufsz = msg_handler(buf, msg, bufsz);
981 free_msg(msg); 985 free_msg(msg);
982 986TS_NET_RX_HARDIRQ_END;
983 return bufsz; 987 return bufsz;
984} 988}
985 989
diff --git a/ipc/msgutil.c b/ipc/msgutil.c
index 2b491590ebab..7570da15a053 100644
--- a/ipc/msgutil.c
+++ b/ipc/msgutil.c
@@ -18,6 +18,12 @@
18#include <linux/utsname.h> 18#include <linux/utsname.h>
19#include <linux/proc_ns.h> 19#include <linux/proc_ns.h>
20#include <linux/uaccess.h> 20#include <linux/uaccess.h>
21#include <linux/dma-mapping.h>
22#include <linux/mempool.h>
23#include <litmus/cache_proc.h>
24#include <litmus/trace.h>
25#include <litmus/litmus.h>
26#include <asm/cacheflush.h>
21 27
22#include "util.h" 28#include "util.h"
23 29
@@ -42,20 +48,37 @@ atomic_t nr_ipc_ns = ATOMIC_INIT(1);
42struct msg_msgseg { 48struct msg_msgseg {
43 struct msg_msgseg *next; 49 struct msg_msgseg *next;
44 /* the next part of the message follows immediately */ 50 /* the next part of the message follows immediately */
51 dma_addr_t seg_handle;
52 size_t seg_len;
45}; 53};
46 54
47#define DATALEN_MSG ((size_t)PAGE_SIZE-sizeof(struct msg_msg)) 55#define DATALEN_MSG ((size_t)PAGE_SIZE-sizeof(struct msg_msg))
48#define DATALEN_SEG ((size_t)PAGE_SIZE-sizeof(struct msg_msgseg)) 56#define DATALEN_SEG ((size_t)PAGE_SIZE-sizeof(struct msg_msgseg))
49 57
58static dma_addr_t handle;
50 59
51static struct msg_msg *alloc_msg(size_t len) 60mempool_t *msgpool;
61extern void *msgvaddr;
62
63static struct msg_msg *alloc_msg(size_t len, long mtype)
52{ 64{
53 struct msg_msg *msg; 65 struct msg_msg *msg;
54 struct msg_msgseg **pseg; 66 struct msg_msgseg **pseg;
55 size_t alen; 67 size_t alen;
68 int n_seg = 0;
56 69
57 alen = min(len, DATALEN_MSG); 70 alen = min(len, DATALEN_MSG);
58 msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL); 71 if (mtype == 1) {
72 //printk(KERN_INFO "SBP message\n");
73 msg = dma_alloc_coherent(NULL, sizeof(*msg) + alen, &handle, GFP_KERNEL|GFP_COLOR|GFP_CPU1);
74 msg->handle = handle;
75 msg->alloc_len = sizeof(*msg) + alen;
76 } else if (mtype == 2) {
77 msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL|GFP_COLOR);
78 } else {
79 //msg = kmalloc(sizeof(*msg) + alen, GFP_KERNEL);
80 msg = msgvaddr;
81 }
59 if (msg == NULL) 82 if (msg == NULL)
60 return NULL; 83 return NULL;
61 84
@@ -67,7 +90,18 @@ static struct msg_msg *alloc_msg(size_t len)
67 while (len > 0) { 90 while (len > 0) {
68 struct msg_msgseg *seg; 91 struct msg_msgseg *seg;
69 alen = min(len, DATALEN_SEG); 92 alen = min(len, DATALEN_SEG);
70 seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL); 93 if (mtype == 1) {
94 seg = dma_alloc_coherent(NULL, sizeof(*seg) + alen, &handle, GFP_KERNEL|GFP_COLOR|GFP_CPU1);
95 seg->seg_handle = handle;
96 seg->seg_len = alen;
97 //printk(KERN_INFO "SBP message seg %d\n", seg->seg_len);
98 } else if (mtype == 2) {
99 seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL|GFP_COLOR);
100 } else {
101 //seg = kmalloc(sizeof(*seg) + alen, GFP_KERNEL);
102 n_seg++;
103 seg = msgvaddr + PAGE_SIZE*n_seg;
104 }
71 if (seg == NULL) 105 if (seg == NULL)
72 goto out_err; 106 goto out_err;
73 *pseg = seg; 107 *pseg = seg;
@@ -83,18 +117,20 @@ out_err:
83 return NULL; 117 return NULL;
84} 118}
85 119
86struct msg_msg *load_msg(const void __user *src, size_t len) 120struct msg_msg *load_msg(const void __user *src, size_t len, long mtype)
87{ 121{
88 struct msg_msg *msg; 122 struct msg_msg *msg;
89 struct msg_msgseg *seg; 123 struct msg_msgseg *seg;
90 int err = -EFAULT; 124 int err = -EFAULT;
91 size_t alen; 125 size_t alen;
92 126
93 msg = alloc_msg(len); 127TS_NET_RX_SOFTIRQ_START;
128 msg = alloc_msg(len, mtype);
94 if (msg == NULL) 129 if (msg == NULL)
95 return ERR_PTR(-ENOMEM); 130 return ERR_PTR(-ENOMEM);
96 131
97 alen = min(len, DATALEN_MSG); 132 alen = min(len, DATALEN_MSG);
133
98 if (copy_from_user(msg + 1, src, alen)) 134 if (copy_from_user(msg + 1, src, alen))
99 goto out_err; 135 goto out_err;
100 136
@@ -105,7 +141,11 @@ struct msg_msg *load_msg(const void __user *src, size_t len)
105 if (copy_from_user(seg + 1, src, alen)) 141 if (copy_from_user(seg + 1, src, alen))
106 goto out_err; 142 goto out_err;
107 } 143 }
108 144TS_NET_RX_SOFTIRQ_END;
145/* if (mtype == 3) {
146 cache_lockdown(0xFFFF8000, smp_processor_id());
147 }
148*/
109 err = security_msg_msg_alloc(msg); 149 err = security_msg_msg_alloc(msg);
110 if (err) 150 if (err)
111 goto out_err; 151 goto out_err;
@@ -172,14 +212,24 @@ int store_msg(void __user *dest, struct msg_msg *msg, size_t len)
172void free_msg(struct msg_msg *msg) 212void free_msg(struct msg_msg *msg)
173{ 213{
174 struct msg_msgseg *seg; 214 struct msg_msgseg *seg;
175 215 long mtype = msg->m_type;
216
176 security_msg_msg_free(msg); 217 security_msg_msg_free(msg);
177 218
178 seg = msg->next; 219 seg = msg->next;
179 kfree(msg); 220 if (mtype == 1) {
221 //printk(KERN_INFO "free_msg(): SBP message\n");
222 dma_free_coherent(NULL, msg->alloc_len, msg, msg->handle);
223 } else if (mtype != 3) {
224 kfree(msg);
225 }
180 while (seg != NULL) { 226 while (seg != NULL) {
181 struct msg_msgseg *tmp = seg->next; 227 struct msg_msgseg *tmp = seg->next;
182 kfree(seg); 228 if (mtype == 1) {
229 //printk(KERN_INFO "free_msg(): SBP message seg %d\n", seg->seg_len);
230 dma_free_coherent(NULL, sizeof(*seg)+(seg->seg_len), seg, seg->seg_handle);
231 } else if (mtype != 3)
232 kfree(seg);
183 seg = tmp; 233 seg = tmp;
184 } 234 }
185} 235}
diff --git a/ipc/util.h b/ipc/util.h
index 1a5a0fcd099c..9a2998308088 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -149,7 +149,7 @@ int ipc_parse_version(int *cmd);
149#endif 149#endif
150 150
151extern void free_msg(struct msg_msg *msg); 151extern void free_msg(struct msg_msg *msg);
152extern struct msg_msg *load_msg(const void __user *src, size_t len); 152extern struct msg_msg *load_msg(const void __user *src, size_t len, long mtype);
153extern struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst); 153extern struct msg_msg *copy_msg(struct msg_msg *src, struct msg_msg *dst);
154extern int store_msg(void __user *dest, struct msg_msg *msg, size_t len); 154extern int store_msg(void __user *dest, struct msg_msg *msg, size_t len);
155 155
diff --git a/kernel/softirq.c b/kernel/softirq.c
index 5c694353763b..a546e77b0c50 100644
--- a/kernel/softirq.c
+++ b/kernel/softirq.c
@@ -276,12 +276,11 @@ restart:
276 kstat_incr_softirqs_this_cpu(vec_nr); 276 kstat_incr_softirqs_this_cpu(vec_nr);
277 277
278 trace_softirq_entry(vec_nr); 278 trace_softirq_entry(vec_nr);
279// if (vec_nr == 3) 279 if (vec_nr == 3)
280// TS_NET_RX_SOFTIRQ_START; 280 TS_NET_RX_SOFTIRQ_START;
281// net_rx_action() is called here 281 h->action(h); //net_rx_action()
282 h->action(h); 282 if (vec_nr == 3)
283// if (vec_nr == 3) 283 TS_NET_RX_SOFTIRQ_END;
284// TS_NET_RX_SOFTIRQ_END;
285 trace_softirq_exit(vec_nr); 284 trace_softirq_exit(vec_nr);
286 if (unlikely(prev_count != preempt_count())) { 285 if (unlikely(prev_count != preempt_count())) {
287 pr_err("huh, entered softirq %u %s %p with preempt_count %08x, exited with %08x?\n", 286 pr_err("huh, entered softirq %u %s %p with preempt_count %08x, exited with %08x?\n",
diff --git a/litmus/bank_proc.c b/litmus/bank_proc.c
index 353d38dbe9d6..3c4f70349133 100644
--- a/litmus/bank_proc.c
+++ b/litmus/bank_proc.c
@@ -548,6 +548,7 @@ out:
548 return ret; 548 return ret;
549} 549}
550 550
551/*
551static struct ctl_table cache_table[] = 552static struct ctl_table cache_table[] =
552{ 553{
553 554
@@ -728,7 +729,8 @@ static struct ctl_table cache_table[] =
728 }, 729 },
729 { } 730 { }
730}; 731};
731 732*/
733/*
732static struct ctl_table litmus_dir_table[] = { 734static struct ctl_table litmus_dir_table[] = {
733 { 735 {
734 .procname = "litmus", 736 .procname = "litmus",
@@ -737,9 +739,9 @@ static struct ctl_table litmus_dir_table[] = {
737 }, 739 },
738 { } 740 { }
739}; 741};
742*/
740 743
741 744//static struct ctl_table_header *litmus_sysctls;
742static struct ctl_table_header *litmus_sysctls;
743 745
744 746
745/* 747/*
@@ -749,7 +751,7 @@ static int __init litmus_color_init(void)
749{ 751{
750 int err=0; 752 int err=0;
751 printk("Init bankproc.c\n"); 753 printk("Init bankproc.c\n");
752 754/*
753 init_variables(); 755 init_variables();
754 756
755 printk(KERN_INFO "Registering LITMUS^RT proc color sysctl.\n"); 757 printk(KERN_INFO "Registering LITMUS^RT proc color sysctl.\n");
@@ -763,7 +765,7 @@ static int __init litmus_color_init(void)
763 765
764 init_color_groups(); 766 init_color_groups();
765 do_add_pages(); 767 do_add_pages();
766 768*/
767 printk(KERN_INFO "Registering LITMUS^RT color and bank proc.\n"); 769 printk(KERN_INFO "Registering LITMUS^RT color and bank proc.\n");
768out: 770out:
769 return err; 771 return err;
diff --git a/litmus/cache_proc.c b/litmus/cache_proc.c
index 102feaf5c9e6..85ba5485acf9 100644
--- a/litmus/cache_proc.c
+++ b/litmus/cache_proc.c
@@ -161,6 +161,9 @@ static int l2_data_prefetch_proc;
161static int os_isolation; 161static int os_isolation;
162static int use_part; 162static int use_part;
163 163
164static u32 debug_test_val;
165struct mutex debug_mutex;
166
164u32 lockdown_reg[9] = { 167u32 lockdown_reg[9] = {
165 0x00000000, 168 0x00000000,
166 0x00000000, 169 0x00000000,
@@ -283,6 +286,7 @@ void litmus_setup_lockdown(void __iomem *base, u32 id)
283 mutex_init(&actlr_mutex); 286 mutex_init(&actlr_mutex);
284 mutex_init(&l2x0_prefetch_mutex); 287 mutex_init(&l2x0_prefetch_mutex);
285 mutex_init(&lockdown_proc); 288 mutex_init(&lockdown_proc);
289 mutex_init(&debug_mutex);
286 raw_spin_lock_init(&cache_lock); 290 raw_spin_lock_init(&cache_lock);
287 raw_spin_lock_init(&prefetch_lock); 291 raw_spin_lock_init(&prefetch_lock);
288 292
@@ -676,6 +680,41 @@ int litmus_l2_data_prefetch_proc_handler(struct ctl_table *table, int write,
676 return ret; 680 return ret;
677} 681}
678 682
683extern void *msgvaddr;
684
685int do_measure(void) {
686 lt_t t1, t2;
687 int i;
688
689 barrier();
690 t1 = litmus_clock();
691 color_read_in_mem_lock(0xFFFF7FFF, 0xFFFF8000, msgvaddr, msgvaddr + 65536);
692 t2 = litmus_clock() - t1;
693 barrier();
694
695 for (i = 0; i < 8; i++) {
696 cache_lockdown(0xFFFF8000, i);
697 }
698 printk("mem read time %lld\n", t2);
699
700 return 0;
701}
702
703int debug_test_handler(struct ctl_table *table, int write,
704 void __user *buffer, size_t *lenp, loff_t *ppos)
705{
706 int ret;
707
708 //mutex_lock(&debug_mutex);
709 //ret = proc_dointvec(table, write, buffer, lenp, ppos);
710 if (write) {
711 ret = do_measure();
712 }
713
714 return ret;
715}
716
717
679int do_perf_test_proc_handler(struct ctl_table *table, int write, 718int do_perf_test_proc_handler(struct ctl_table *table, int write,
680 void __user *buffer, size_t *lenp, loff_t *ppos); 719 void __user *buffer, size_t *lenp, loff_t *ppos);
681 720
@@ -871,6 +910,11 @@ static struct ctl_table cache_table[] =
871 .extra1 = &way_partition_min, 910 .extra1 = &way_partition_min,
872 .extra2 = &way_partition_max, 911 .extra2 = &way_partition_max,
873 }, 912 },
913 {
914 .procname = "debug_test",
915 .mode = 0644,
916 .proc_handler = debug_test_handler,
917 },
874 { } 918 { }
875}; 919};
876 920
@@ -1201,12 +1245,13 @@ asmlinkage long sys_lock_buffer(void* vaddr, size_t size, u32 lock_way, u32 unlo
1201 1245
1202static int perf_test(void) { 1246static int perf_test(void) {
1203 struct timespec before, after; 1247 struct timespec before, after;
1204 struct page *page; 1248 struct page *page, *page2;
1205 void *vaddr; 1249 void *vaddr, *vaddr2;
1206 u32 *data; 1250 u32 *data, *data2;
1207 long time, flush_time; 1251 long time, flush_time;
1208 int i, num_pages = 1; 1252 int i, n, num_pages = 1;
1209 unsigned int order = 4; 1253 unsigned int order = 2;
1254 lt_t t1 = 0, t2 = 0;
1210 1255
1211 for (i = 0; i < order; i++) { 1256 for (i = 0; i < order; i++) {
1212 num_pages = num_pages*2; 1257 num_pages = num_pages*2;
@@ -1220,11 +1265,35 @@ static int perf_test(void) {
1220 return -ENOMEM; 1265 return -ENOMEM;
1221 } 1266 }
1222 1267
1268 page2 = alloc_pages(__GFP_MOVABLE, order);
1269 if (!page2) {
1270 printk(KERN_WARNING "No memory\n");
1271 return -ENOMEM;
1272 }
1273
1223 vaddr = page_address(page); 1274 vaddr = page_address(page);
1224 if (!vaddr) 1275 if (!vaddr)
1225 printk(KERN_WARNING "%s: vaddr is null\n", __FUNCTION__); 1276 printk(KERN_WARNING "%s: vaddr is null\n", __FUNCTION__);
1226 data = (u32*) vaddr; 1277 data = (u32*) vaddr;
1227 1278
1279 vaddr2 = page_address(page2);
1280 if (!vaddr2)
1281 printk(KERN_WARNING "%s: vaddr2 is null\n", __FUNCTION__);
1282 data2 = (u32*) vaddr2;
1283
1284 for (i = 32; i < 4096; i *= 2) {
1285 for (n = 0; n < TRIALS; n++) {
1286 invalidate_kernel_vmap_range(vaddr, 8192);
1287 invalidate_kernel_vmap_range(vaddr2, 8192);
1288 barrier();
1289 t1 = litmus_clock();
1290 memcpy(vaddr2, vaddr, i);
1291 barrier();
1292 t2 += litmus_clock() - t1;
1293 }
1294 printk("Size %d, average for memcpy %lld\n", i, t2>>9);
1295 }
1296/*
1228 getnstimeofday(&before); 1297 getnstimeofday(&before);
1229 barrier(); 1298 barrier();
1230 for (i = 0; i < TRIALS; i++) { 1299 for (i = 0; i < TRIALS; i++) {
@@ -1277,9 +1346,10 @@ static int perf_test(void) {
1277 time = update_timeval(before, after); 1346 time = update_timeval(before, after);
1278 printk("Average for read in after write: %ld\n", time / TRIALS); 1347 printk("Average for read in after write: %ld\n", time / TRIALS);
1279 1348
1280 1349*/
1281 //free_page((unsigned long)vaddr); 1350 //free_page((unsigned long)vaddr);
1282 free_pages((unsigned long)vaddr, order); 1351 free_pages((unsigned long)vaddr, order);
1352 free_pages((unsigned long)vaddr2, order);
1283 1353
1284 return 0; 1354 return 0;
1285} 1355}
diff --git a/litmus/litmus.c b/litmus/litmus.c
index ec9379979e1a..144e3bfdcfc1 100644
--- a/litmus/litmus.c
+++ b/litmus/litmus.c
@@ -18,6 +18,7 @@
18#include <linux/mm.h> 18#include <linux/mm.h>
19#include <linux/memcontrol.h> 19#include <linux/memcontrol.h>
20#include <linux/mm_inline.h> 20#include <linux/mm_inline.h>
21#include <linux/mempool.h>
21 22
22#include <litmus/litmus.h> 23#include <litmus/litmus.h>
23#include <litmus/bheap.h> 24#include <litmus/bheap.h>
@@ -604,7 +605,7 @@ asmlinkage long sys_test_call(unsigned int param)
604 } 605 }
605 606
606 TRACE_TASK(current, "addr: %08x, phy: %08x, color: %d, bank: %d, pfn: %05lx, _mapcount: %d, _count: %d flags: %s%s%s mapping: %p\n", vma_itr->vm_start + PAGE_SIZE*i, page_to_phys(old_page), page_color(old_page), page_bank(old_page), page_to_pfn(old_page), page_mapcount(old_page), page_count(old_page), vma_itr->vm_flags&VM_READ?"r":"-", vma_itr->vm_flags&VM_WRITE?"w":"-", vma_itr->vm_flags&VM_EXEC?"x":"-", &(old_page->mapping)); 607 TRACE_TASK(current, "addr: %08x, phy: %08x, color: %d, bank: %d, pfn: %05lx, _mapcount: %d, _count: %d flags: %s%s%s mapping: %p\n", vma_itr->vm_start + PAGE_SIZE*i, page_to_phys(old_page), page_color(old_page), page_bank(old_page), page_to_pfn(old_page), page_mapcount(old_page), page_count(old_page), vma_itr->vm_flags&VM_READ?"r":"-", vma_itr->vm_flags&VM_WRITE?"w":"-", vma_itr->vm_flags&VM_EXEC?"x":"-", &(old_page->mapping));
607 printk(KERN_INFO "addr: %08x, phy: %08x, color: %d, bank: %d, pfn: %05lx, _mapcount: %d, _count: %d flags: %s%s%s mapping: %p\n", vma_itr->vm_start + PAGE_SIZE*i, page_to_phys(old_page), page_color(old_page), page_bank(old_page), page_to_pfn(old_page), page_mapcount(old_page), page_count(old_page), vma_itr->vm_flags&VM_READ?"r":"-", vma_itr->vm_flags&VM_WRITE?"w":"-", vma_itr->vm_flags&VM_EXEC?"x":"-", &(old_page->mapping)); 608 //printk(KERN_INFO "addr: %08x, phy: %08x, color: %d, bank: %d, pfn: %05lx, _mapcount: %d, _count: %d flags: %s%s%s mapping: %p\n", vma_itr->vm_start + PAGE_SIZE*i, page_to_phys(old_page), page_color(old_page), page_bank(old_page), page_to_pfn(old_page), page_mapcount(old_page), page_count(old_page), vma_itr->vm_flags&VM_READ?"r":"-", vma_itr->vm_flags&VM_WRITE?"w":"-", vma_itr->vm_flags&VM_EXEC?"x":"-", &(old_page->mapping));
608 put_page(old_page); 609 put_page(old_page);
609 } 610 }
610 vma_itr = vma_itr->vm_next; 611 vma_itr = vma_itr->vm_next;
@@ -623,6 +624,8 @@ asmlinkage long sys_test_call(unsigned int param)
623 } 624 }
624 rcu_read_unlock(); 625 rcu_read_unlock();
625 } 626 }
627 } else if (param == 2) {
628 flush_cache_all();
626 } 629 }
627 630
628 return ret; 631 return ret;
@@ -959,6 +962,35 @@ static struct notifier_block shutdown_notifier = {
959 .notifier_call = litmus_shutdown_nb, 962 .notifier_call = litmus_shutdown_nb,
960}; 963};
961 964
965extern mempool_t *msgpool;
966struct page *msgpages;
967void *msgvaddr;
968
969static int litmus_msgpool_init(void)
970{
971 int i;
972 lt_t t1, t2;
973
974 msgpages = alloc_pages(GFP_KERNEL, 4);
975 if (!msgpages) {
976 printk(KERN_WARNING "No memory\n");
977 return -ENOMEM;
978 }
979 msgvaddr = page_address(msgpages);
980
981 printk(KERN_INFO "pfn %05lx addr %p\n", page_to_pfn(msgpages), msgvaddr);
982
983 for (i = 0; i < 8; i++) {
984 cache_lockdown(0xFFFF8000, i);
985 }
986 t1 = litmus_clock();
987 color_read_in_mem_lock(0xFFFF7FFF, 0xFFFF8000, msgvaddr, msgvaddr + 65536);
988 t2 = litmus_clock() - t1;
989 printk(KERN_INFO "mem read time %lld\n", t2);
990
991 return 0;
992}
993
962static int __init _init_litmus(void) 994static int __init _init_litmus(void)
963{ 995{
964 /* Common initializers, 996 /* Common initializers,
@@ -993,7 +1025,9 @@ static int __init _init_litmus(void)
993 color_mask = ((cache_info_sets << line_size_log) - 1) ^ (PAGE_SIZE - 1); 1025 color_mask = ((cache_info_sets << line_size_log) - 1) ^ (PAGE_SIZE - 1);
994 printk("Page color mask %lx\n", color_mask); 1026 printk("Page color mask %lx\n", color_mask);
995#endif 1027#endif
996 1028
1029 litmus_msgpool_init();
1030
997 return 0; 1031 return 0;
998} 1032}
999 1033
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 8c22d10b0c23..3fc137b3ac36 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -1299,7 +1299,7 @@ struct page *__rmqueue_smallest(struct zone *zone, unsigned int order,
1299 } 1299 }
1300 1300
1301 set_freepage_migratetype(page, migratetype); 1301 set_freepage_migratetype(page, migratetype);
1302 //printk(KERN_INFO "__rmqueue_smallest(): CPU%d COLOR %d BANK %d page return %p pfn:%05lx\n", cpu, page_color(page), page_bank(page), page, page_to_pfn(page)); 1302 //printk(KERN_INFO "__rmqueue_smallest(): CPU%d COLOR %d BANK %d page order %d return %p pfn:%05lx\n", cpu, page_color(page), page_bank(page), order, page, page_to_pfn(page));
1303 return page; 1303 return page;
1304 } 1304 }
1305 } else { 1305 } else {
@@ -1630,7 +1630,7 @@ __rmqueue_fallback(struct zone *zone, unsigned int order, int start_migratetype,
1630 trace_mm_page_alloc_extfrag(page, order, current_order, 1630 trace_mm_page_alloc_extfrag(page, order, current_order,
1631 start_migratetype, fallback_mt); 1631 start_migratetype, fallback_mt);
1632 1632
1633 //printk(KERN_INFO "__rmqueue_fallback(): CPU%d COLOR %d BANK %d page return %p pfn:%05lx\n", cpu, page_color(page), page_bank(page), page, page_to_pfn(page)); 1633 //printk(KERN_INFO "P%d __rmqueue_fallback(): cpu%d's bank COLOR %d BANK %d page order %d return %p pfn:%05lx\n", cpu, area_index, page_color(page), page_bank(page), order, page, page_to_pfn(page));
1634 return page; 1634 return page;
1635 } 1635 }
1636 } else { 1636 } else {
diff --git a/mm/slab_common.c b/mm/slab_common.c
index bbd0ddc0b029..dec9075e486b 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -30,6 +30,13 @@ LIST_HEAD(slab_caches);
30DEFINE_MUTEX(slab_mutex); 30DEFINE_MUTEX(slab_mutex);
31struct kmem_cache *kmem_cache; 31struct kmem_cache *kmem_cache;
32 32
33//#define ENABLE_WORST_CASE 1
34#ifdef ENABLE_WORST_CASE
35#define KMEM_FLAG (GFP_COLOR|GFP_CPU1)
36#else
37#define KMEM_FLAG (0)
38#endif
39
33/* 40/*
34 * Set of flags that will prevent slab merging 41 * Set of flags that will prevent slab merging
35 */ 42 */
@@ -303,7 +310,7 @@ do_kmem_cache_create(const char *name, size_t object_size, size_t size,
303 int err; 310 int err;
304 311
305 err = -ENOMEM; 312 err = -ENOMEM;
306 s = kmem_cache_zalloc(kmem_cache, GFP_KERNEL); 313 s = kmem_cache_zalloc(kmem_cache, GFP_KERNEL|KMEM_FLAG);
307 if (!s) 314 if (!s)
308 goto out; 315 goto out;
309 316
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 7a6d7de8fff8..c7ac2adfd667 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1757,7 +1757,7 @@ EXPORT_SYMBOL(vmalloc);
1757void *vmalloc_color(unsigned long size) 1757void *vmalloc_color(unsigned long size)
1758{ 1758{
1759 return __vmalloc_node_flags(size, NUMA_NO_NODE, 1759 return __vmalloc_node_flags(size, NUMA_NO_NODE,
1760 GFP_KERNEL | __GFP_HIGHMEM | GFP_COLOR); 1760 GFP_KERNEL | __GFP_HIGHMEM | GFP_COLOR | GFP_CPU1);
1761} 1761}
1762EXPORT_SYMBOL(vmalloc_color); 1762EXPORT_SYMBOL(vmalloc_color);
1763 1763
diff --git a/net/core/dev.c b/net/core/dev.c
index f02d0c582e84..7291e7ec8696 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -138,6 +138,13 @@
138 138
139#include "net-sysfs.h" 139#include "net-sysfs.h"
140 140
141//#define ENABLE_WORST_CASE 1
142#ifdef ENABLE_WORST_CASE
143#define DEV_FLAG (GFP_COLOR|GFP_CPU1)
144#else
145#define DEV_FLAG (0)
146#endif
147
141/* Instead of increasing this, you should create a hash table. */ 148/* Instead of increasing this, you should create a hash table. */
142#define MAX_GRO_SKBS 8 149#define MAX_GRO_SKBS 8
143 150
@@ -1718,7 +1725,7 @@ EXPORT_SYMBOL_GPL(is_skb_forwardable);
1718 1725
1719int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb) 1726int __dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
1720{ 1727{
1721 if (skb_orphan_frags(skb, GFP_ATOMIC) || 1728 if (skb_orphan_frags(skb, GFP_ATOMIC|DEV_FLAG) ||
1722 unlikely(!is_skb_forwardable(dev, skb))) { 1729 unlikely(!is_skb_forwardable(dev, skb))) {
1723 atomic_long_inc(&dev->rx_dropped); 1730 atomic_long_inc(&dev->rx_dropped);
1724 kfree_skb(skb); 1731 kfree_skb(skb);
@@ -1762,7 +1769,7 @@ static inline int deliver_skb(struct sk_buff *skb,
1762 struct packet_type *pt_prev, 1769 struct packet_type *pt_prev,
1763 struct net_device *orig_dev) 1770 struct net_device *orig_dev)
1764{ 1771{
1765 if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) 1772 if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC|DEV_FLAG)))
1766 return -ENOMEM; 1773 return -ENOMEM;
1767 atomic_inc(&skb->users); 1774 atomic_inc(&skb->users);
1768 return pt_prev->func(skb, skb->dev, pt_prev, orig_dev); 1775 return pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
@@ -1827,7 +1834,7 @@ again:
1827 } 1834 }
1828 1835
1829 /* need to clone skb, done only once */ 1836 /* need to clone skb, done only once */
1830 skb2 = skb_clone(skb, GFP_ATOMIC); 1837 skb2 = skb_clone(skb, GFP_ATOMIC|DEV_FLAG);
1831 if (!skb2) 1838 if (!skb2)
1832 goto out_unlock; 1839 goto out_unlock;
1833 1840
@@ -1986,7 +1993,7 @@ static struct xps_map *expand_xps_map(struct xps_map *map,
1986 } 1993 }
1987 1994
1988 /* Need to allocate new map to store queue on this CPU's map */ 1995 /* Need to allocate new map to store queue on this CPU's map */
1989 new_map = kzalloc_node(XPS_MAP_SIZE(alloc_len), GFP_KERNEL, 1996 new_map = kzalloc_node(XPS_MAP_SIZE(alloc_len), GFP_KERNEL|DEV_FLAG,
1990 cpu_to_node(cpu)); 1997 cpu_to_node(cpu));
1991 if (!new_map) 1998 if (!new_map)
1992 return NULL; 1999 return NULL;
@@ -2018,7 +2025,7 @@ int netif_set_xps_queue(struct net_device *dev, const struct cpumask *mask,
2018 continue; 2025 continue;
2019 2026
2020 if (!new_dev_maps) 2027 if (!new_dev_maps)
2021 new_dev_maps = kzalloc(maps_sz, GFP_KERNEL); 2028 new_dev_maps = kzalloc(maps_sz, GFP_KERNEL|DEV_FLAG);
2022 if (!new_dev_maps) { 2029 if (!new_dev_maps) {
2023 mutex_unlock(&xps_map_mutex); 2030 mutex_unlock(&xps_map_mutex);
2024 return -ENOMEM; 2031 return -ENOMEM;
@@ -2398,7 +2405,7 @@ int skb_checksum_help(struct sk_buff *skb)
2398 2405
2399 if (skb_cloned(skb) && 2406 if (skb_cloned(skb) &&
2400 !skb_clone_writable(skb, offset + sizeof(__sum16))) { 2407 !skb_clone_writable(skb, offset + sizeof(__sum16))) {
2401 ret = pskb_expand_head(skb, 0, 0, GFP_ATOMIC); 2408 ret = pskb_expand_head(skb, 0, 0, GFP_ATOMIC|DEV_FLAG);
2402 if (ret) 2409 if (ret)
2403 goto out; 2410 goto out;
2404 } 2411 }
@@ -3777,7 +3784,7 @@ ncls:
3777 } 3784 }
3778 3785
3779 if (pt_prev) { 3786 if (pt_prev) {
3780 if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC))) 3787 if (unlikely(skb_orphan_frags(skb, GFP_ATOMIC|DEV_FLAG)))
3781 goto drop; 3788 goto drop;
3782 else 3789 else
3783 ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); 3790 ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev);
@@ -6259,7 +6266,7 @@ static int netif_alloc_rx_queues(struct net_device *dev)
6259 6266
6260 BUG_ON(count < 1); 6267 BUG_ON(count < 1);
6261 6268
6262 rx = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); 6269 rx = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT | DEV_FLAG);
6263 if (!rx) { 6270 if (!rx) {
6264 rx = vzalloc(sz); 6271 rx = vzalloc(sz);
6265 if (!rx) 6272 if (!rx)
@@ -6300,7 +6307,7 @@ static int netif_alloc_netdev_queues(struct net_device *dev)
6300 6307
6301 BUG_ON(count < 1 || count > 0xffff); 6308 BUG_ON(count < 1 || count > 0xffff);
6302 6309
6303 tx = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); 6310 tx = kzalloc(sz, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT | DEV_FLAG);
6304 if (!tx) { 6311 if (!tx) {
6305 tx = vzalloc(sz); 6312 tx = vzalloc(sz);
6306 if (!tx) 6313 if (!tx)
@@ -6735,7 +6742,7 @@ struct netdev_queue *dev_ingress_queue_create(struct net_device *dev)
6735#ifdef CONFIG_NET_CLS_ACT 6742#ifdef CONFIG_NET_CLS_ACT
6736 if (queue) 6743 if (queue)
6737 return queue; 6744 return queue;
6738 queue = kzalloc(sizeof(*queue), GFP_KERNEL); 6745 queue = kzalloc(sizeof(*queue), GFP_KERNEL|DEV_FLAG);
6739 if (!queue) 6746 if (!queue)
6740 return NULL; 6747 return NULL;
6741 netdev_init_one_queue(dev, queue, NULL); 6748 netdev_init_one_queue(dev, queue, NULL);
@@ -6808,7 +6815,7 @@ struct net_device *alloc_netdev_mqs(int sizeof_priv, const char *name,
6808 /* ensure 32-byte alignment of whole construct */ 6815 /* ensure 32-byte alignment of whole construct */
6809 alloc_size += NETDEV_ALIGN - 1; 6816 alloc_size += NETDEV_ALIGN - 1;
6810 6817
6811 p = kzalloc(alloc_size, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); 6818 p = kzalloc(alloc_size, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT | DEV_FLAG);
6812 if (!p) 6819 if (!p)
6813 p = vzalloc(alloc_size); 6820 p = vzalloc(alloc_size);
6814 if (!p) 6821 if (!p)
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 92f091ce1d47..0407fe78a4f1 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -77,7 +77,7 @@
77#include <linux/capability.h> 77#include <linux/capability.h>
78#include <linux/user_namespace.h> 78#include <linux/user_namespace.h>
79 79
80#define ENABLE_WORST_CASE 1 80//#define ENABLE_WORST_CASE 1
81#ifdef ENABLE_WORST_CASE 81#ifdef ENABLE_WORST_CASE
82#define SKB_FLAG (GFP_COLOR|GFP_CPU1) 82#define SKB_FLAG (GFP_COLOR|GFP_CPU1)
83#else 83#else
@@ -1255,11 +1255,11 @@ struct sk_buff *skb_realloc_headroom(struct sk_buff *skb, unsigned int headroom)
1255 int delta = headroom - skb_headroom(skb); 1255 int delta = headroom - skb_headroom(skb);
1256 1256
1257 if (delta <= 0) 1257 if (delta <= 0)
1258 skb2 = pskb_copy(skb, GFP_ATOMIC); 1258 skb2 = pskb_copy(skb, GFP_ATOMIC | SKB_FLAG);
1259 else { 1259 else {
1260 skb2 = skb_clone(skb, GFP_ATOMIC); 1260 skb2 = skb_clone(skb, GFP_ATOMIC | SKB_FLAG);
1261 if (skb2 && pskb_expand_head(skb2, SKB_DATA_ALIGN(delta), 0, 1261 if (skb2 && pskb_expand_head(skb2, SKB_DATA_ALIGN(delta), 0,
1262 GFP_ATOMIC)) { 1262 GFP_ATOMIC | SKB_FLAG)) {
1263 kfree_skb(skb2); 1263 kfree_skb(skb2);
1264 skb2 = NULL; 1264 skb2 = NULL;
1265 } 1265 }
@@ -1481,7 +1481,7 @@ int ___pskb_trim(struct sk_buff *skb, unsigned int len)
1481 int err; 1481 int err;
1482 1482
1483 if (skb_cloned(skb) && 1483 if (skb_cloned(skb) &&
1484 unlikely((err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC)))) 1484 unlikely((err = pskb_expand_head(skb, 0, 0, GFP_ATOMIC|SKB_FLAG))))
1485 return err; 1485 return err;
1486 1486
1487 i = 0; 1487 i = 0;
@@ -1516,7 +1516,7 @@ drop_pages:
1516 if (skb_shared(frag)) { 1516 if (skb_shared(frag)) {
1517 struct sk_buff *nfrag; 1517 struct sk_buff *nfrag;
1518 1518
1519 nfrag = skb_clone(frag, GFP_ATOMIC); 1519 nfrag = skb_clone(frag, GFP_ATOMIC|SKB_FLAG);
1520 if (unlikely(!nfrag)) 1520 if (unlikely(!nfrag))
1521 return -ENOMEM; 1521 return -ENOMEM;
1522 1522
@@ -1589,7 +1589,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta)
1589 1589
1590 if (eat > 0 || skb_cloned(skb)) { 1590 if (eat > 0 || skb_cloned(skb)) {
1591 if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0, 1591 if (pskb_expand_head(skb, 0, eat > 0 ? eat + 128 : 0,
1592 GFP_ATOMIC)) 1592 GFP_ATOMIC|SKB_FLAG))
1593 return NULL; 1593 return NULL;
1594 } 1594 }
1595 1595
@@ -1637,7 +1637,7 @@ unsigned char *__pskb_pull_tail(struct sk_buff *skb, int delta)
1637 1637
1638 if (skb_shared(list)) { 1638 if (skb_shared(list)) {
1639 /* Sucks! We need to fork list. :-( */ 1639 /* Sucks! We need to fork list. :-( */
1640 clone = skb_clone(list, GFP_ATOMIC); 1640 clone = skb_clone(list, GFP_ATOMIC|SKB_FLAG);
1641 if (!clone) 1641 if (!clone)
1642 return NULL; 1642 return NULL;
1643 insp = list->next; 1643 insp = list->next;
@@ -2313,7 +2313,7 @@ skb_zerocopy(struct sk_buff *to, struct sk_buff *from, int len, int hlen)
2313 to->len += len + plen; 2313 to->len += len + plen;
2314 to->data_len += len + plen; 2314 to->data_len += len + plen;
2315 2315
2316 if (unlikely(skb_orphan_frags(from, GFP_ATOMIC))) { 2316 if (unlikely(skb_orphan_frags(from, GFP_ATOMIC|SKB_FLAG))) {
2317 skb_tx_error(from); 2317 skb_tx_error(from);
2318 return -ENOMEM; 2318 return -ENOMEM;
2319 } 2319 }
@@ -2607,7 +2607,7 @@ EXPORT_SYMBOL(skb_split);
2607 */ 2607 */
2608static int skb_prepare_for_shift(struct sk_buff *skb) 2608static int skb_prepare_for_shift(struct sk_buff *skb)
2609{ 2609{
2610 return skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC); 2610 return skb_cloned(skb) && pskb_expand_head(skb, 0, 0, GFP_ATOMIC|SKB_FLAG);
2611} 2611}
2612 2612
2613/** 2613/**
@@ -3073,7 +3073,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
3073 frag++; 3073 frag++;
3074 } 3074 }
3075 3075
3076 nskb = skb_clone(list_skb, GFP_ATOMIC); 3076 nskb = skb_clone(list_skb, GFP_ATOMIC|SKB_FLAG);
3077 list_skb = list_skb->next; 3077 list_skb = list_skb->next;
3078 3078
3079 if (unlikely(!nskb)) 3079 if (unlikely(!nskb))
@@ -3095,7 +3095,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
3095 __skb_push(nskb, doffset); 3095 __skb_push(nskb, doffset);
3096 } else { 3096 } else {
3097 nskb = __alloc_skb(hsize + doffset + headroom, 3097 nskb = __alloc_skb(hsize + doffset + headroom,
3098 GFP_ATOMIC, skb_alloc_rx_flag(head_skb), 3098 GFP_ATOMIC|SKB_FLAG, skb_alloc_rx_flag(head_skb),
3099 NUMA_NO_NODE); 3099 NUMA_NO_NODE);
3100 3100
3101 if (unlikely(!nskb)) 3101 if (unlikely(!nskb))
@@ -3163,7 +3163,7 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
3163 goto err; 3163 goto err;
3164 } 3164 }
3165 3165
3166 if (unlikely(skb_orphan_frags(frag_skb, GFP_ATOMIC))) 3166 if (unlikely(skb_orphan_frags(frag_skb, GFP_ATOMIC|SKB_FLAG)))
3167 goto err; 3167 goto err;
3168 3168
3169 *nskb_frag = *frag; 3169 *nskb_frag = *frag;
@@ -3497,7 +3497,7 @@ int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer)
3497 * space, 128 bytes is fair. */ 3497 * space, 128 bytes is fair. */
3498 3498
3499 if (skb_tailroom(skb) < tailbits && 3499 if (skb_tailroom(skb) < tailbits &&
3500 pskb_expand_head(skb, 0, tailbits-skb_tailroom(skb)+128, GFP_ATOMIC)) 3500 pskb_expand_head(skb, 0, tailbits-skb_tailroom(skb)+128, GFP_ATOMIC|SKB_FLAG))
3501 return -ENOMEM; 3501 return -ENOMEM;
3502 3502
3503 /* Voila! */ 3503 /* Voila! */
@@ -3539,12 +3539,12 @@ int skb_cow_data(struct sk_buff *skb, int tailbits, struct sk_buff **trailer)
3539 3539
3540 /* Fuck, we are miserable poor guys... */ 3540 /* Fuck, we are miserable poor guys... */
3541 if (ntail == 0) 3541 if (ntail == 0)
3542 skb2 = skb_copy(skb1, GFP_ATOMIC); 3542 skb2 = skb_copy(skb1, GFP_ATOMIC|SKB_FLAG);
3543 else 3543 else
3544 skb2 = skb_copy_expand(skb1, 3544 skb2 = skb_copy_expand(skb1,
3545 skb_headroom(skb1), 3545 skb_headroom(skb1),
3546 ntail, 3546 ntail,
3547 GFP_ATOMIC); 3547 GFP_ATOMIC|SKB_FLAG);
3548 if (unlikely(skb2 == NULL)) 3548 if (unlikely(skb2 == NULL))
3549 return -ENOMEM; 3549 return -ENOMEM;
3550 3550
@@ -3641,7 +3641,7 @@ struct sk_buff *skb_clone_sk(struct sk_buff *skb)
3641 if (!sk || !atomic_inc_not_zero(&sk->sk_refcnt)) 3641 if (!sk || !atomic_inc_not_zero(&sk->sk_refcnt))
3642 return NULL; 3642 return NULL;
3643 3643
3644 clone = skb_clone(skb, GFP_ATOMIC); 3644 clone = skb_clone(skb, GFP_ATOMIC|SKB_FLAG);
3645 if (!clone) { 3645 if (!clone) {
3646 sock_put(sk); 3646 sock_put(sk);
3647 return NULL; 3647 return NULL;
@@ -3725,9 +3725,9 @@ void __skb_tstamp_tx(struct sk_buff *orig_skb,
3725 return; 3725 return;
3726 3726
3727 if (tsonly) 3727 if (tsonly)
3728 skb = alloc_skb(0, GFP_ATOMIC); 3728 skb = alloc_skb(0, GFP_ATOMIC|SKB_FLAG);
3729 else 3729 else
3730 skb = skb_clone(orig_skb, GFP_ATOMIC); 3730 skb = skb_clone(orig_skb, GFP_ATOMIC|SKB_FLAG);
3731 if (!skb) 3731 if (!skb)
3732 return; 3732 return;
3733 3733
@@ -4222,7 +4222,7 @@ struct sk_buff *skb_vlan_untag(struct sk_buff *skb)
4222 return skb; 4222 return skb;
4223 } 4223 }
4224 4224
4225 skb = skb_share_check(skb, GFP_ATOMIC); 4225 skb = skb_share_check(skb, GFP_ATOMIC|SKB_FLAG);
4226 if (unlikely(!skb)) 4226 if (unlikely(!skb))
4227 goto err_free; 4227 goto err_free;
4228 4228
@@ -4260,7 +4260,7 @@ int skb_ensure_writable(struct sk_buff *skb, int write_len)
4260 if (!skb_cloned(skb) || skb_clone_writable(skb, write_len)) 4260 if (!skb_cloned(skb) || skb_clone_writable(skb, write_len))
4261 return 0; 4261 return 0;
4262 4262
4263 return pskb_expand_head(skb, 0, 0, GFP_ATOMIC); 4263 return pskb_expand_head(skb, 0, 0, GFP_ATOMIC|SKB_FLAG);
4264} 4264}
4265EXPORT_SYMBOL(skb_ensure_writable); 4265EXPORT_SYMBOL(skb_ensure_writable);
4266 4266