1<!-- Creator : groff version 1.22.3 --> 2<!-- CreationDate: Mon Aug 28 02:48:47 2017 --> 3<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" 4"http://www.w3.org/TR/html4/loose.dtd"> 5<html> 6<head> 7<meta name="generator" content="groff -Thtml, see www.gnu.org"> 8<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> 9<meta name="Content-Style" content="text/css"> 10<style type="text/css"> 11 p { margin-top: 0; margin-bottom: 0; vertical-align: top } 12 pre { margin-top: 0; margin-bottom: 0; vertical-align: top } 13 table { margin-top: 0; margin-bottom: 0; vertical-align: top } 14 h1 { text-align: center } 15</style> 16<title>mtcp_core_affinitize</title> 17<link rel="stylesheet" href="./common.css"> 18</head> 19<body> 20<div class="main"> 21<h1 align="center">mtcp_core_affinitize</h1> 22<!-- 23<a href="#NAME">NAME</a><br> 24<a href="#SYNOPSIS">SYNOPSIS</a><br> 25<a href="#DESCRIPTION">DESCRIPTION</a><br> 26<a href="#RETURN VALUE">RETURN VALUE</a><br> 27<a href="#NOTES">NOTES</a><br> 28<a href="#AUTHORS">AUTHORS</a><br> 29<a href="#SEE ALSO">SEE ALSO</a><br> 30<a href="#COLOPHON">COLOPHON</a><br> 31 32<hr> 33--> 34 35<h2>NAME 36<a name="NAME"></a> 37</h2> 38 39 40 41<p style="margin-left:11%; margin-top: 1em">mtcp_core_affinitize 42− bind a calling thread to a specific CPU core</p> 43 44<h2>SYNOPSIS 45<a name="SYNOPSIS"></a> 46</h2> 47 48 49<p style="margin-left:11%; margin-top: 1em"><b>#include 50<mtcp_api.h></b></p> 51 52<p style="margin-left:11%; margin-top: 1em"><b>int 53mtcp_core_affinitize(int</b> <i>cpu</i><b>);</b></p> 54 55<h2>DESCRIPTION 56<a name="DESCRIPTION"></a> 57</h2> 58 59 60 61<p style="margin-left:11%; margin-top: 1em"><b>mtcp_core_affinitize</b>() 62binds a calling thread to a specifc CPU core. This function 63is a utility function which internally performs 64<b>sched_setaffinity</b>() for dedicating one CPU to a 65particular thread, and <b>numa_set_membind</b>() for 66restricting any future memory allocation to happen within 67the NUMA node.</p> 68 69<p style="margin-left:11%; margin-top: 1em">This function 70is used by end TCP applications to pin their application 71threads to a specific core in order to gain performance 72benefits. For example, restricting an application thread to 73run on a single CPU core avoids any cache invalidation that 74can be caused when the thread is moved from one CPU core to 75another CPU core.</p> 76 77<p style="margin-left:11%; margin-top: 1em">The function 78requires a sole <i>cpu</i> integer argument that passes the 79CPU core-id of the system on which the stack is 80instantiated.</p> 81 82<h2>RETURN VALUE 83<a name="RETURN VALUE"></a> 84</h2> 85 86 87<p style="margin-left:11%; margin-top: 1em">Returns 0 on 88success; -1 on failure.</p> 89 90<h2>NOTES 91<a name="NOTES"></a> 92</h2> 93 94 95<p style="margin-left:11%; margin-top: 1em">Passing an 96invalid CPU core-id (value < 0 or value > max_cpus) 97will prevent the creation of the mTCP stack.</p> 98 99<h2>AUTHORS 100<a name="AUTHORS"></a> 101</h2> 102 103 104<p style="margin-left:11%; margin-top: 1em">mOS development 105team <[email protected]></p> 106 107<h2>SEE ALSO 108<a name="SEE ALSO"></a> 109</h2> 110 111 112 113<p style="margin-left:11%; margin-top: 1em"><b>mtcp_create_context</b>()</p> 114 115<h2>COLOPHON 116<a name="COLOPHON"></a> 117</h2> 118 119 120<p style="margin-left:11%; margin-top: 1em">This page is 121part of mOS release 0.3 <i>docs</i> section. A description 122of the project, and information about reporting bugs, can be 123found at http://mos.kaist.edu/.</p> 124<hr> 125<div class="footer"> 126 <img src="back-arrow.jpg" width="2%" height="2%"><a href="http://mos.kaist.edu/index_man.html">Back to Index</a> 127</div> 128</div> 129</body> 130</html> 131