{"id":42,"date":"2006-12-07T00:42:40","date_gmt":"2006-12-07T00:42:40","guid":{"rendered":"http:\/\/techa.nanosleep.org\/wp\/index.php\/2006\/12\/07\/well-situated-friendly-neighborhood\/"},"modified":"2019-08-23T04:28:13","modified_gmt":"2019-08-23T02:28:13","slug":"well-situated-friendly-neighborhood","status":"publish","type":"post","link":"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/","title":{"rendered":"Well Situated, Friendly Neighborhood"},"content":{"rendered":"<p><a href=\"\/\/bmaurer.blogspot.com\/2006\/03\/memory-usage-with-smaps.html\" rel=\"nofollow\">Ben<\/a> has some good news for anyone interested in reducing the memory usage of Linux programs. Smaps is great. But does it tell the whole truth?<\/p>\n<p>For PCs with (basically) limitless swap space, it\u2019s possible that it doesn\u2019t even come close. The reason: Under memory pressure, only memory pages that are actually being accessed will be kept in main memory. These pages are usually 4kB each. So how much of a hog your process will be is determined by its access pattern. Which brings us to our dear old friend, Locality. It\u2019s easy enough to deduce that a process with many tiny, frequently accessed memory blocks sprinkled in between \u201clow urgency\u201d blocks over a lot of pages will be a disaster compared to a process with frequently-accessed data allocated close together.<\/p>\n<p>So, it\u2019s possible that an even better measure of a process\u2019 memory badness would be a running count of \u201cnumber of <em>different<\/em> pages accessed in the last 10 seconds\u201d, possibly with a falloff function (think load average). Maybe this could be done with a <a href=\"http:\/\/valgrind.org\/\">Valgrind<\/a> tool, a la <a href=\"http:\/\/valgrind.org\/docs\/manual\/cg-manual.html\">Cachegrind<\/a> but for VM pages instead of CPU cache lines? Maybe it could even tell you where the N most frequently accessed memory blocks were allocated, and for each block, provide a list of locations where it was accessed (sorted by time last accessed or by frequency).<\/p>\n<p>That sounds like a fun project!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Ben has some good news for anyone interested in reducing the memory usage of Linux programs. Smaps is great. But does it tell the whole truth? For PCs with (basically) limitless swap space, it\u2019s possible that it doesn\u2019t even come &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-gnome"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Well Situated, Friendly Neighborhood - Et tu, Cthulhu<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Well Situated, Friendly Neighborhood - Et tu, Cthulhu\" \/>\n<meta property=\"og:description\" content=\"Ben has some good news for anyone interested in reducing the memory usage of Linux programs. Smaps is great. But does it tell the whole truth? For PCs with (basically) limitless swap space, it\u2019s possible that it doesn\u2019t even come &hellip;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/\" \/>\n<meta property=\"og:site_name\" content=\"Et tu, Cthulhu\" \/>\n<meta property=\"article:published_time\" content=\"2006-12-07T00:42:40+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-08-23T02:28:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/01\/site-icon.png\" \/>\n\t<meta property=\"og:image:width\" content=\"512\" \/>\n\t<meta property=\"og:image:height\" content=\"512\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Hans Petter Jansson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@hpj\" \/>\n<meta name=\"twitter:site\" content=\"@hpj\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Hans Petter Jansson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/\"},\"author\":{\"name\":\"Hans Petter Jansson\",\"@id\":\"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c\"},\"headline\":\"Well Situated, Friendly Neighborhood\",\"datePublished\":\"2006-12-07T00:42:40+00:00\",\"dateModified\":\"2019-08-23T02:28:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/\"},\"wordCount\":239,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c\"},\"articleSection\":[\"GNOME\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/\",\"url\":\"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/\",\"name\":\"Well Situated, Friendly Neighborhood - Et tu, Cthulhu\",\"isPartOf\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/#website\"},\"datePublished\":\"2006-12-07T00:42:40+00:00\",\"dateModified\":\"2019-08-23T02:28:13+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/hpjansson.org\/blag\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Well Situated, Friendly Neighborhood\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/hpjansson.org\/blag\/#website\",\"url\":\"https:\/\/hpjansson.org\/blag\/\",\"name\":\"Et tu, Cthulhu\",\"description\":\"Personal blag of Hans Petter Jansson: Fun with computers edition\",\"publisher\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/hpjansson.org\/blag\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c\",\"name\":\"Hans Petter Jansson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/33402e5005b34e5ee4ba4f9fd0c5d754f4505d5fb455736e5c585676cb7f2075?s=96&d=retro&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/33402e5005b34e5ee4ba4f9fd0c5d754f4505d5fb455736e5c585676cb7f2075?s=96&d=retro&r=g\",\"caption\":\"Hans Petter Jansson\"},\"logo\":{\"@id\":\"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/image\/\"},\"sameAs\":[\"https:\/\/hpjansson.org\/\",\"https:\/\/x.com\/hpj\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Well Situated, Friendly Neighborhood - Et tu, Cthulhu","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/","og_locale":"en_US","og_type":"article","og_title":"Well Situated, Friendly Neighborhood - Et tu, Cthulhu","og_description":"Ben has some good news for anyone interested in reducing the memory usage of Linux programs. Smaps is great. But does it tell the whole truth? For PCs with (basically) limitless swap space, it\u2019s possible that it doesn\u2019t even come &hellip;","og_url":"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/","og_site_name":"Et tu, Cthulhu","article_published_time":"2006-12-07T00:42:40+00:00","article_modified_time":"2019-08-23T02:28:13+00:00","og_image":[{"width":512,"height":512,"url":"https:\/\/hpjansson.org\/blag\/wp-content\/uploads\/2019\/01\/site-icon.png","type":"image\/png"}],"author":"Hans Petter Jansson","twitter_card":"summary_large_image","twitter_creator":"@hpj","twitter_site":"@hpj","twitter_misc":{"Written by":"Hans Petter Jansson","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/#article","isPartOf":{"@id":"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/"},"author":{"name":"Hans Petter Jansson","@id":"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c"},"headline":"Well Situated, Friendly Neighborhood","datePublished":"2006-12-07T00:42:40+00:00","dateModified":"2019-08-23T02:28:13+00:00","mainEntityOfPage":{"@id":"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/"},"wordCount":239,"commentCount":0,"publisher":{"@id":"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c"},"articleSection":["GNOME"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/","url":"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/","name":"Well Situated, Friendly Neighborhood - Et tu, Cthulhu","isPartOf":{"@id":"https:\/\/hpjansson.org\/blag\/#website"},"datePublished":"2006-12-07T00:42:40+00:00","dateModified":"2019-08-23T02:28:13+00:00","breadcrumb":{"@id":"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/hpjansson.org\/blag\/2006\/12\/07\/well-situated-friendly-neighborhood\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/hpjansson.org\/blag\/"},{"@type":"ListItem","position":2,"name":"Well Situated, Friendly Neighborhood"}]},{"@type":"WebSite","@id":"https:\/\/hpjansson.org\/blag\/#website","url":"https:\/\/hpjansson.org\/blag\/","name":"Et tu, Cthulhu","description":"Personal blag of Hans Petter Jansson: Fun with computers edition","publisher":{"@id":"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/hpjansson.org\/blag\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/a86f9dc39a36a8184d6e6f9a759f235c","name":"Hans Petter Jansson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/33402e5005b34e5ee4ba4f9fd0c5d754f4505d5fb455736e5c585676cb7f2075?s=96&d=retro&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/33402e5005b34e5ee4ba4f9fd0c5d754f4505d5fb455736e5c585676cb7f2075?s=96&d=retro&r=g","caption":"Hans Petter Jansson"},"logo":{"@id":"https:\/\/hpjansson.org\/blag\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/hpjansson.org\/","https:\/\/x.com\/hpj"]}]}},"_links":{"self":[{"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":2,"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"predecessor-version":[{"id":529,"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/posts\/42\/revisions\/529"}],"wp:attachment":[{"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hpjansson.org\/blag\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}