aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorNamhoon Kim <namhoonk@cs.unc.edu>2016-09-22 14:49:49 -0400
committerNamhoon Kim <namhoonk@cs.unc.edu>2016-09-22 14:49:49 -0400
commitd7352bf3c9392104c34b56e2c0756a14db81b68a (patch)
tree34a42a02bb6ce3a10b00ce5fa9302ab182d3aae0 /mm/filemap.c
parent2b1bccf411c97a933796526b0427785a2dafde1d (diff)
9/22/2016
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c129
1 files changed, 116 insertions, 13 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 8f378ac675d7..60d7e38cf73d 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -36,6 +36,9 @@
36#include <linux/rmap.h> 36#include <linux/rmap.h>
37#include "internal.h" 37#include "internal.h"
38 38
39#include <litmus/litmus.h>
40#include <litmus/mc2_common.h>
41
39#define CREATE_TRACE_POINTS 42#define CREATE_TRACE_POINTS
40#include <trace/events/filemap.h> 43#include <trace/events/filemap.h>
41 44
@@ -970,13 +973,23 @@ repeat:
970 page = NULL; 973 page = NULL;
971 pagep = radix_tree_lookup_slot(&mapping->page_tree, offset); 974 pagep = radix_tree_lookup_slot(&mapping->page_tree, offset);
972 if (pagep) { 975 if (pagep) {
973 void *pdesc; 976 page = radix_tree_deref_slot(pagep);
974 pdesc = radix_tree_deref_slot(pagep);
975 if (pdesc)
976 page = (struct page*)pdesc;
977 //page = radix_tree_deref_slot(pagep);
978 if (unlikely(!page)) 977 if (unlikely(!page))
979 goto out; 978 goto out;
979 if (is_pcache_desc(page)) {
980 struct pcache_desc *pcd;
981
982printk(KERN_INFO "PCACHE_DESC\n");
983
984 pcd = ptr_to_pcache_desc(page);
985 page = pcd->master;
986 page_cache_get_speculative(page);
987
988 unreplicate_pcache(mapping, page->index);
989
990 goto out;
991 }
992
980 if (radix_tree_exception(page)) { 993 if (radix_tree_exception(page)) {
981 if (radix_tree_deref_retry(page)) 994 if (radix_tree_deref_retry(page))
982 goto repeat; 995 goto repeat;
@@ -1175,6 +1188,21 @@ repeat:
1175 page = radix_tree_deref_slot(slot); 1188 page = radix_tree_deref_slot(slot);
1176 if (unlikely(!page)) 1189 if (unlikely(!page))
1177 continue; 1190 continue;
1191
1192 if (is_pcache_desc(page)) {
1193 struct pcache_desc *pcd;
1194
1195printk(KERN_INFO "PCACHE_DESC\n");
1196
1197 pcd = ptr_to_pcache_desc(page);
1198 page = pcd->master;
1199 page_cache_get_speculative(page);
1200
1201 unreplicate_pcache(mapping, page->index);
1202
1203 goto export;
1204 }
1205
1178 if (radix_tree_exception(page)) { 1206 if (radix_tree_exception(page)) {
1179 if (radix_tree_deref_retry(page)) 1207 if (radix_tree_deref_retry(page))
1180 goto restart; 1208 goto restart;
@@ -1238,6 +1266,20 @@ repeat:
1238 if (unlikely(!page)) 1266 if (unlikely(!page))
1239 continue; 1267 continue;
1240 1268
1269 if (is_pcache_desc(page)) {
1270 struct pcache_desc *pcd;
1271
1272printk(KERN_INFO "PCACHE_DESC\n");
1273
1274 pcd = ptr_to_pcache_desc(page);
1275 page = pcd->master;
1276 page_cache_get_speculative(page);
1277
1278 unreplicate_pcache(mapping, page->index);
1279
1280 goto export;
1281 }
1282
1241 if (radix_tree_exception(page)) { 1283 if (radix_tree_exception(page)) {
1242 if (radix_tree_deref_retry(page)) { 1284 if (radix_tree_deref_retry(page)) {
1243 /* 1285 /*
@@ -1264,7 +1306,7 @@ repeat:
1264 page_cache_release(page); 1306 page_cache_release(page);
1265 goto repeat; 1307 goto repeat;
1266 } 1308 }
1267 1309export:
1268 pages[ret] = page; 1310 pages[ret] = page;
1269 if (++ret == nr_pages) 1311 if (++ret == nr_pages)
1270 break; 1312 break;
@@ -1306,6 +1348,21 @@ repeat:
1306 if (unlikely(!page)) 1348 if (unlikely(!page))
1307 break; 1349 break;
1308 1350
1351 if (is_pcache_desc(page)) {
1352 struct pcache_desc *pcd;
1353
1354printk(KERN_INFO "PCACHE_DESC\n");
1355
1356 pcd = ptr_to_pcache_desc(page);
1357 page = pcd->master;
1358 if (!page_cache_get_speculative(page))
1359 goto repeat;
1360
1361 unreplicate_pcache(mapping, page->index);
1362
1363 goto export;
1364 }
1365
1309 if (radix_tree_exception(page)) { 1366 if (radix_tree_exception(page)) {
1310 if (radix_tree_deref_retry(page)) { 1367 if (radix_tree_deref_retry(page)) {
1311 /* 1368 /*
@@ -1331,7 +1388,7 @@ repeat:
1331 page_cache_release(page); 1388 page_cache_release(page);
1332 goto repeat; 1389 goto repeat;
1333 } 1390 }
1334 1391export:
1335 /* 1392 /*
1336 * must check mapping and index after taking the ref. 1393 * must check mapping and index after taking the ref.
1337 * otherwise we can get both false positives and false 1394 * otherwise we can get both false positives and false
@@ -1382,6 +1439,10 @@ repeat:
1382 if (unlikely(!page)) 1439 if (unlikely(!page))
1383 continue; 1440 continue;
1384 1441
1442 if (is_pcache_desc(page)) {
1443 BUG();
1444 }
1445
1385 if (radix_tree_exception(page)) { 1446 if (radix_tree_exception(page)) {
1386 if (radix_tree_deref_retry(page)) { 1447 if (radix_tree_deref_retry(page)) {
1387 /* 1448 /*
@@ -1489,7 +1550,13 @@ static ssize_t do_generic_file_read(struct file *filp, loff_t *ppos,
1489 1550
1490 cond_resched(); 1551 cond_resched();
1491find_page: 1552find_page:
1492 page = find_get_page(mapping, index); 1553 if (tsk_mc2_data(current)) {
1554 printk(KERN_INFO "RT Task file_read1\n");
1555 page = find_get_page_readonly(mapping, index);
1556 }
1557 else
1558 page = find_get_page(mapping, index);
1559
1493 if (!page) { 1560 if (!page) {
1494 page_cache_sync_readahead(mapping, 1561 page_cache_sync_readahead(mapping,
1495 ra, filp, 1562 ra, filp,
@@ -1526,7 +1593,6 @@ page_ok:
1526 * part of the page is not copied back to userspace (unless 1593 * part of the page is not copied back to userspace (unless
1527 * another truncate extends the file - this is desired though). 1594 * another truncate extends the file - this is desired though).
1528 */ 1595 */
1529
1530 isize = i_size_read(inode); 1596 isize = i_size_read(inode);
1531 end_index = (isize - 1) >> PAGE_CACHE_SHIFT; 1597 end_index = (isize - 1) >> PAGE_CACHE_SHIFT;
1532 if (unlikely(!isize || index > end_index)) { 1598 if (unlikely(!isize || index > end_index)) {
@@ -1544,7 +1610,16 @@ page_ok:
1544 } 1610 }
1545 } 1611 }
1546 nr = nr - offset; 1612 nr = nr - offset;
1547 1613
1614 if (tsk_mc2_data(current)) {
1615 printk(KERN_INFO "RT Task file_read2\n");
1616 page_cache_release(page);
1617 page = find_get_page_readonly(mapping, index);
1618 if (!page) {
1619 BUG();
1620 }
1621 }
1622
1548 /* If users can be writing to this page using arbitrary 1623 /* If users can be writing to this page using arbitrary
1549 * virtual addresses, take care about potential aliasing 1624 * virtual addresses, take care about potential aliasing
1550 * before reading the page on the kernel side. 1625 * before reading the page on the kernel side.
@@ -1885,7 +1960,13 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1885 /* 1960 /*
1886 * Do we have something in the page cache already? 1961 * Do we have something in the page cache already?
1887 */ 1962 */
1888 page = find_get_page(mapping, offset); 1963 if (tsk_mc2_data(current)) {
1964 printk(KERN_INFO "RT Task filemap_fault1\n");
1965 page = find_get_page_readonly(mapping, offset);
1966 }
1967 else
1968 page = find_get_page(mapping, offset);
1969
1889 if (likely(page) && !(vmf->flags & FAULT_FLAG_TRIED)) { 1970 if (likely(page) && !(vmf->flags & FAULT_FLAG_TRIED)) {
1890 /* 1971 /*
1891 * We found the page, so try async readahead before 1972 * We found the page, so try async readahead before
@@ -1899,7 +1980,13 @@ int filemap_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
1899 mem_cgroup_count_vm_event(vma->vm_mm, PGMAJFAULT); 1980 mem_cgroup_count_vm_event(vma->vm_mm, PGMAJFAULT);
1900 ret = VM_FAULT_MAJOR; 1981 ret = VM_FAULT_MAJOR;
1901retry_find: 1982retry_find:
1902 page = find_get_page(mapping, offset); 1983 if (tsk_mc2_data(current)) {
1984 printk(KERN_INFO "RT Task filemap_fault2\n");
1985 page = find_get_page_readonly(mapping, offset);
1986 }
1987 else
1988 page = find_get_page(mapping, offset);
1989
1903 if (!page) 1990 if (!page)
1904 goto no_cached_page; 1991 goto no_cached_page;
1905 } 1992 }
@@ -2007,6 +2094,22 @@ repeat:
2007 page = radix_tree_deref_slot(slot); 2094 page = radix_tree_deref_slot(slot);
2008 if (unlikely(!page)) 2095 if (unlikely(!page))
2009 goto next; 2096 goto next;
2097
2098 if (is_pcache_desc(page)) {
2099 struct pcache_desc *pcd;
2100
2101printk(KERN_INFO "PCACHE_DESC\n");
2102
2103 pcd = ptr_to_pcache_desc(page);
2104 page = pcd->master;
2105 if (!page_cache_get_speculative(page))
2106 goto repeat;
2107
2108 unreplicate_pcache(mapping, page->index);
2109
2110 goto export;
2111 }
2112
2010 if (radix_tree_exception(page)) { 2113 if (radix_tree_exception(page)) {
2011 if (radix_tree_deref_retry(page)) 2114 if (radix_tree_deref_retry(page))
2012 break; 2115 break;
@@ -2022,7 +2125,7 @@ repeat:
2022 page_cache_release(page); 2125 page_cache_release(page);
2023 goto repeat; 2126 goto repeat;
2024 } 2127 }
2025 2128export:
2026 if (!PageUptodate(page) || 2129 if (!PageUptodate(page) ||
2027 PageReadahead(page) || 2130 PageReadahead(page) ||
2028 PageHWPoison(page)) 2131 PageHWPoison(page))