From 99d8034d7338f3b2fb4aafe4a515e27b601cd267 Mon Sep 17 00:00:00 2001 From: Peter Norvig Date: Mon, 31 Oct 2022 19:49:12 -0700 Subject: [PATCH] Add files via upload --- ipynb/Goldberg.ipynb | 1024 ++++++++++++++++++++++++------------------ 1 file changed, 596 insertions(+), 428 deletions(-) diff --git a/ipynb/Goldberg.ipynb b/ipynb/Goldberg.ipynb index 1d2e4b5..b1c4a29 100644 --- a/ipynb/Goldberg.ipynb +++ b/ipynb/Goldberg.ipynb @@ -33,19 +33,19 @@ "source": [ "## Unsmoothed Maximum Likelihood Character Level Language Model \n", "\n", - "The name is quite long, but the idea is very simple. We want a model whose job is to guess the next character based on the previous *n* letters. For example, having seen `ello`, the next characer is likely to be either a commma or space (if we assume is is the end of the word \"hello\"), or the letter `w` if we believe we are in the middle of the word \"mellow\". Humans are quite good at this, but of course seeing a larger history makes things easier (if we were to see 5 letters instead of 4, the choice between space and `w` would have been much easier).\n", + "The name is quite long, but the idea is very simple. We want a model whose job is to guess the next character based on the previous *n* characters. For example, having seen `ello`, the next characer is likely to be either a commma or space (if we assume is is the end of the word \"hello\"), or the letter `w` if we believe we are in the middle of the word \"mellow\" or \"yellow\". Humans are quite good at this, but of course seeing a larger history makes things easier (if we were to see 5 letters instead of 4, the choice between space and `w` would have been much easier).\n", "\n", "We will call *n*, the number of letters we need to guess based on, the _order_ of the language model.\n", "\n", - "RNNs and LSTMs can potentially learn infinite-order language model (they guess the next character based on a \"state\" which supposedly encode all the previous history). We here will restrict ourselves to a fixed-order language model.\n", + "RNNs and LSTMs can potentially learn infinite-order language model (they guess the next character based on a \"state\" which supposedly encodes all the previous history). We here will restrict ourselves to a fixed-order language model.\n", "\n", - "So, we are seeing *n* letters, and need to guess the *n+1*th one. We are also given a large-ish amount of text (say, all of Shakespear works) that we can use. How would we go about solving this task?\n", + "So, we are seeing *n* letters, and need to guess the *n+1*th one. We are also given a large-ish amount of text (say, all of Shakespeare's works) that we can use. How would we go about solving this task?\n", "\n", - "Mathematically, we would like to learn a function *P(c* | *h)*. Here, *c* is a character, *h* is a *n*-letters history, and *P(c* | *h)* stands for how likely is it to see *c* after we've seen *h*.\n", + "Mathematically, we would like to learn a function *P(c* | *h)*. Here, *c* is a character, *h* is a *n*-character history, and *P(c* | *h)* stands for how likely is it to see *c* after we've seen *h*.\n", "\n", "Perhaps the simplest approach would be to just count and divide (a.k.a **maximum likelihood estimates**). We will count the number of times each letter *c* appeared after *h*, and divide by the total numbers of letters appearing after *h*. The **unsmoothed** part means that if we did not see a given letter following *h*, we will just give it a probability of zero.\n", "\n", - "And that's all there is to it.\n" + "And that's all there is to it." ] }, { @@ -59,7 +59,7 @@ }, { "cell_type": "code", - "execution_count": 1, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ @@ -69,19 +69,19 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": null, "metadata": {}, "outputs": [], "source": [ "class LanguageModel(collections.defaultdict):\n", - " \"\"\"A mapping from `order` history characters to a Counter of {'c': count} pairs,\n", - " e.g., for order=4, {'spea': Counter({'k': 9, 'r': 1})}.\"\"\"\n", + " \"\"\"A mapping from `order` history characters to possible next characters and their \n", + " frequency, e.g. {'spea': Counter({'k': 9, 'r': 1})} lets us generate 'speak' or 'spear'.\"\"\"\n", " def __init__(self, order): \n", " self.order = order\n", " self.default_factory = collections.Counter \n", "\n", "def train_char_lm(fname, order=4) -> LanguageModel:\n", - " \"\"\"Train an `order`-gram character-level language model on all the text in `fname`.\"\"\"\n", + " \"\"\"Train an character-level language model of given order on all the text in `fname`.\"\"\"\n", " lm = LanguageModel(order)\n", " data = (order * PAD) + open(fname).read()\n", " for i in range(order, len(data)):\n", @@ -98,7 +98,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Let's train it on Andrej's Shakespeare text:" + "Let's train a model on Andrej's Shakespeare text:" ] }, { @@ -137,7 +137,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "Ok. Now let's do some queries:" + "Ok. Now let's do some queries on the language model:" ] }, { @@ -271,21 +271,116 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "So `\"ello\"` is followed by either space, punctuation or `w` (or `r`, `u`, `n`), `\"Firs\"` is pretty much deterministic, and the word following `\"rst \"` can start with pretty much every letter." + "So `\"ello\"` is followed by either space, punctuation or `w` (or `r`, `u`, `n`), `\"Firs\"` is pretty much deterministic, and the word following `\"rst \"` can start with pretty much every letter. \n", + "\n", + "## Character Probabilities\n", + "\n", + "We can extract probabilities *P(c* | *h)* from the model as follows:" + ] + }, + { + "cell_type": "code", + "execution_count": 8, + "metadata": {}, + "outputs": [], + "source": [ + "def P(c, h, lm) -> float: \n", + " \"\"\"The probability P(c | h) of next character c given history h, according to the language model.\"\"\"\n", + " return lm[h][c] / lm[h].total" + ] + }, + { + "cell_type": "code", + "execution_count": 9, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.817717206132879" + ] + }, + "execution_count": 9, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "P('w', 'ello', lm)" + ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "1.0" + ] + }, + "execution_count": 10, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "P('t', 'Firs', lm)" + ] + }, + { + "cell_type": "code", + "execution_count": 11, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.0" + ] + }, + "execution_count": 11, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "P('x', 'Firs', lm)" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": {}, + "outputs": [ + { + "data": { + "text/plain": [ + "0.16292134831460675" + ] + }, + "execution_count": 12, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "P('S', 'rst ', lm)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Generating from the model\n", + "## Generating sample text from a model\n", "\n", - "To generate a random text from a model, we maintain a history of *order* characters, which starts with all pad characters. We then enter a loop that randomly samples a character from the history's counter, then updates the history by dropping its first character and adding the randomly-sampled character to the end. " + "To randomly generate a sample text from a model, we maintain a history of *order* characters, starting with all pad characters. We then enter a loop that looks up the history in the language model, randomly samples a character from the history's counter, then updates the history by dropping its first character and adding the randomly-sampled character to the end. " ] }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 13, "metadata": {}, "outputs": [], "source": [ @@ -304,12 +399,12 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "To sample a single character from a counter, randomly choose an integer *n* from 1 to the total count of characters in the counter, then iterate through (character, count) items until the cumulative total of the counts meets or exceeds *n*." + "To sample a single character *c* from a counter, randomly choose an integer *n* from 1 to the total count of characters in the counter, then iterate through the counter until the cumulative total of the counts meets or exceeds *n*." ] }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 14, "metadata": {}, "outputs": [], "source": [ @@ -317,26 +412,26 @@ " \"\"\"Randomly sample the nth character from the counter.\"\"\"\n", " n = random.randint(1, counter.total)\n", " cumulative = 0\n", - " for ch in counter:\n", - " cumulative += counter[ch]\n", + " for c in counter:\n", + " cumulative += counter[c]\n", " if cumulative >= n: \n", - " return ch" + " return c" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ - "## Generated Shakespeare from different order models\n", + "## Generating Shakespeare text from different order models\n", "\n", "Let's try to generate text based on different language-model orders. Let's start with something silly:\n", "\n", - "## order 2:" + "## Order 2:" ] }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 15, "metadata": { "collapsed": false, "jupyter": { @@ -348,43 +443,38 @@ "name": "stdout", "output_type": "stream", "text": [ - "Fireve notenink by in and my hillan foll harseceare.\n", + "Fir,\n", + "ACBENE:\n", + "But st thaverforn'd his then my ther's one,\n", + "Whe Lonce de kinger, ap the sa? Whee mus ne.\n", "\n", - "Secers faing tom th, dre met speat's ano weauld derve,\n", - "OPHOPANG Roy, so grive us thishat me hall\n", - "That liall hen a\n", - "goin souren;' ther hou hust peavio.\n", - "BET:\n", - "Forat th ofend now bainch sed cur hou mat fatied shour men of\n", - "And ne hinese so may; somminto scall for taking iftlee the been siome this and naby thure dont.\n", - "RO:\n", - "Ther to-ny no ithe of I me drit, car! wer talk army deris to not ity\n", - "shearmonerstlet he gove proultre dink agiver cand swe ithe a glus,\n", - "SIDUKENE:\n", - "Yor.\n", + "But of ithice soaciven loven one my I ch hight sithe or ble-ern the my wherephy graidia,\n", + "a belf;\n", + "Ay, quare hins an an:\n", + "Whem'd cur beek, Hecomat on my he arry Riciuse, giver nothery: nal.\n", "\n", - "Marrows anters, stemusere, bourects smennown here me thave ap asleand my forter tel\n", - "So liket wit.\n", + "DUKE:\n", + "Hold but,\n", + "And to moul ford\n", + "ant ace\n", + "wore hime re shathis onsol th I dis spried!\n", "\n", - "Runt?\n", + "SIR Lorthat mor ent: sur suchast the spoo, wit, the in hief-wis hand lor reand way be wo set this solorsee Dand, loot the makin am hisfourab:\n", + "Bar his the frortithe uponowee:\n", + "Is han hour leyessin on to and take my pas and to alset hatterialow\n", + "Suchaso you\n", + "be creest to tak alks.\n", "\n", - "Nor me for pose\n", - "Def ing thempood I coame thoppestimp.\n", - "Tell ittle willy\n", - "As con\n", - "To thy soner\n", - "bless'd hasarcults what of thers nour\n", - "Why laillord!\n", + "PATIANTIS Fraff,\n", + "ime proier theatholk yould a the raingrain anith, th hardso I halmorge th wall wast liver,\n", + "in theall-dayst this craire swot Pere whow And nobeece\n", + "Tithall, ar,\n", + "Thar und of ch mandrefor the\n", + "Andes, Dest allighe an:\n", + "Warrow thavererstund no lad your som of why nothat my whows be pur hat chou!\n", "\n", - "MIL:\n", - "Forent itill down, ficke ord younsucks, lie dook:\n", - "Hear, a dill sty 't of togue; the I daus swast con now's anch lown re.\n", - "MENRY VIRANTO:\n", - "The ty, gonfectis me,\n", - "Tak Ridst\n", - "But all the of thothienday wilead him.\n", - "\n", - "By to yess war\n" + "SLYCUS:\n", + "It th withith it pon spe myse \n" ] } ], @@ -397,7 +487,7 @@ "cell_type": "markdown", "metadata": {}, "source": [ - "## order 4 \n", + "## Order 4 \n", "\n", "Order 2 was not so great... but what if we increase the order to 4?\n", "\n" @@ -405,7 +495,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 16, "metadata": { "collapsed": false, "jupyter": { @@ -417,44 +507,42 @@ "name": "stdout", "output_type": "stream", "text": [ - "First Servantagem mayst can shall tends, the been of whether that senses of thou not her, sure that sure remain, thronet an expense.\n", + "First Murderer:\n", + "Unquet thee one; and chant:\n", + "Birons--\n", + "Poor cheeks they much my bosom sorrow! how stops as him your honest,\n", + "And it better? Rugby, if you pleasures, all me writter of men.\n", "\n", - "Fool, her?\n", - "'Twas be told me?\n", + "EGLAMOUR:\n", + "Ay, but him a tready the work madam?\n", "\n", - "SHALLOW:\n", - "De siege.\n", + "MENENIUS:\n", + "Lamentony conquer'd in purpose; above.\n", "\n", - "VALENTIO:\n", - "Never thy Montentend of rever my good quited, with laid best be? Tellingerous beseech were month.\n", + "SIR ANDRONICUS:\n", + "And be my pardon my father for ink, he's greaten him bound thus?\n", + "Let thee,\n", + "And lady, willius' tongue deed world.\n", "\n", - "KING CLAUDIUS:\n", - "He is faces.\n", + "PRINCE EDWARD:\n", + "As love hold, to be constantiately captains o' thee, purs and Petructified: but his judgment.\n", "\n", - "CLAUDIUS:\n", - "In sure, and I hit foolish\n", - "As well teach yours, Here,\n", - "How does into thing more upon moves mother funerald it my very thank\n", - "That here often'd me.\n", - "Her hath broth\n", - "What wingeneral rob: if them here is jestion the baby you and thee.\n", + "THUR:\n", + "O Lord of thou the bold not as well take thus sends--takings thready friends, but that he sleep o' the neverended.\n", "\n", - "HELENA:\n", - "O, their is,\n", - "And fig orders of fixed in these edges I would up, you this, for the good Service wilt seems to Caesar sing, smoking; and die, you may come wish these bed.\n", + "MACDUFF:\n", + "Venice that blasp and him was faults struth the more of men so well;\n", + "Ford, I should betray in this in the bear you,\n", + "To sand I hadst travery,\n", + "Yet, herrily;\n", + "And bed to king: God sense\n", + "Caius with and still behind.\n", "\n", - "PETRUCHIO:\n", - "Falstaff ore to fast would I have show naked not what let us wrathe, and promio, thouse: and Mortime:\n", - "Both about of his that's hence how dukes inder you.\n", - "\n", - "TRANIO:\n", - "At Melun.\n", - "\n", - "Fourtier and take my some frust and my known\n", - "Ever her too.\n", - "\n", - "TALBOT:\n", - "La man h\n" + "SUFFOLK:\n", + "Right a tear\n", + "shout of suborned so prince him. Your titless'd the better is be the she, swell!\n", + "This a little come, and sons;\n", + "\n" ] } ], @@ -469,14 +557,14 @@ "source": [ "\n", "\n", - "## order 7\n", + "## Order 7\n", "\n", "Order 4 is already quite reasonable, and reads like English. Just 4 letters history! What if we increase it to 7?" ] }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 17, "metadata": { "collapsed": false, "jupyter": { @@ -489,42 +577,39 @@ "output_type": "stream", "text": [ "First Citizen:\n", - "Soft! take my castle call a new-devised impeach young one,\n", - "Were not\n", - "worth ten time to speak out,\n", - "Which Salique land:\n", - "Your mark his charge and sack great earnest of his practise, Gloucester, thou mean, he's hunted with this here stands,\n", - "'Tis one with such a question: his disturbed spirit, set a-work;\n", - "And so should I have in the liveries, all encertain money.\n", + "Before I keep the\n", + "sounder a rhyme nor pinch the engenders you:\n", + "And he was the valour that blows, they did;\n", + "So I grow; I prospero my lords,\n", + "Will creep into strong,\n", + "And I'll rake up, pipers.\n", "\n", - "PERICLES:\n", - "How can these our favours\n", - "Have sat too curious, three thou wert as wise and right royal 'twas mine;\n", - "It is some taste of hers,\n", - "Hath seen such a place the event.\n", - "'Tis politic; he crosses to it, boy.\n", + "FALSTAFF:\n", + "Fie! you played the midwife present a large and grave,\n", + "Being simply; the honour,\n", + "Purchase the good hope\n", + "The period to make us medicine of kindness: I dare not making?\n", "\n", - "QUEEN MARGARET:\n", - "Give him,\n", - "for my battle's lost:\n", - "That well;\n", - "But bear my life.\n", - "I beg thy particular,--you had known well I shaked,\n", - "Which I feel.\n", - "I fight a question. Hubert, keep aloof at bay:\n", - "Sell ever soft hours,\n", - "Unless than thine own gladness he passage 'tis!--whose eyes can volley.\n", + "GONZALO:\n", + "All's hush'd with the vast sea: at land:\n", + "Come, come, come, though, haply, are you colours turn'd youth: who best king of though\n", + "The enmity.\n", "\n", - "HAMLET:\n", - "How angerly.\n", + "ORLEANS:\n", + "He's alive, I was not angry indeed to him.\n", "\n", - "PETRUCHIO:\n", - "Why, then it is\n", - "There were in our loves you,\n", - "A sea of glory, Gallia wars.\n", + "MENENIUS:\n", + "I loved withal: except a sword, despite of brooded waters, and\n", + "that all tire.\n", "\n", - "BASTARD:\n", - "Though he be n\n" + "WARWICK:\n", + "Ay, sir, an she to be doubtful for those that\n", + "it will have my country's wreck, to transportance;\n", + "Sometimes, like a rebel,\n", + "And dreadful object him, till the fashion? do I not known\n", + "No less home, you wrestler's\n", + "heels a huge to be impart to hide thee much to live created one of you; which marriage move\n", + "And she is fast\n" ] } ], @@ -542,7 +627,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 18, "metadata": { "collapsed": false, "jupyter": { @@ -555,43 +640,42 @@ "output_type": "stream", "text": [ "First Citizen:\n", - "Doth this news; yet what I have been a breakfast, washes his\n", - "hands, and save yourself!\n", - "My master, my dear Moth?\n", + "Read the will.\n", "\n", - "MOTH:\n", - "No, nor a man cannot make\n", - "him eat it that spake\n", - "that word?\n", + "ANTONY:\n", + "He will seek\n", + "Some way to leave as keep; whose top to climb\n", + "Is certain and shameless callet know herself.\n", + "Helen of Greece! what should I curse the ducats.'\n", "\n", - "QUINTUS:\n", - "Not so, an't please your highness, give us any thing for my labour by his own attaint?\n", - "'Tis doubt he will utter?\n", + "SALARINO:\n", + "That's not my meaning:\n", + "go to thy cost.\n", "\n", - "BRUTUS:\n", - "Hence! I will follow it! Come, and get to Naples? Keep in Tunis,\n", - "And Ferdinand, her brothers both from death,\n", - "But lusty, young, and of antiquity too; bawd-born.\n", - "Farewell, sweet Jack\n", - "Falstaff, where hath been prophesied France and Ireland\n", - "Bear that play;\n", - "For never yet a breaker of\n", - "proverbs: he will answer it. Some pigeons, Davy, a couple of Ford's\n", - "knaves, his hinds, bars me the poor\n", - "duke's office should do the duke of this place and great\n", - "ones I dare not: Sir Pierce of Exton, who\n", - "lately came from valiant Oxford?\n", - "How far hence\n", - "In mine own away;\n", - "But you gave in charge,\n", - "Is now dishonour me.\n", + "VERNON:\n", + "There is no force in the first, how get hence:\n", + "Why should the gods to witness from their colour fly,\n", + "And to become the function takes,\n", + "The ear more quick of apprehensions, motions,\n", + "as promising\n", + "Than a wild dedication; facere, as it grows.\n", "\n", - "SUFFOLK:\n", - "Who waits there?\n", + "Poet:\n", + "Ay, that I can do it: I\n", + "commend you well, my lord,\n", + "Grievous complaint; hasty and tinder-like\n", + "upon too trivial motion; one that, in King Edward's good success hath done to-day\n", + "Mad and fantastical banquet, just so much they love his lady was but devised at first, to try her skill,\n", + "Reignier, whose frank heart gave all,--\n", + "O, that way and you to your majesty had call'd you up, have held him dear.\n", "\n", - "RODERIGO:\n", - "I know not; except, in that as ever\n", - "knapped\n" + "BEVIS:\n", + "Come, and believe thee,\n", + "Were they not by you?\n", + "\n", + "LENNOX:\n", + "Ay, my good lord;\n", + "'Tis but the gods to inte\n" ] } ], @@ -615,7 +699,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 19, "metadata": {}, "outputs": [ { @@ -658,7 +742,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 20, "metadata": { "collapsed": false, "jupyter": { @@ -681,7 +765,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 21, "metadata": { "collapsed": false, "jupyter": { @@ -694,44 +778,51 @@ "output_type": "stream", "text": [ "/*\n", - " * linux/kernel_stat.h>\n", + " * linux/kernel.h>\n", + "#include \n", + "#include \n", + "#include \n", + "#include \"rcu.h\"\n", "\n", - "int rcu_cpu_notify(CPU_CLUSTER_PM_EXIT, -1, NULL);\n", - "}\n", + "MODULE_AUTHOR(\"Paul E. McKenney GRAPH_MAX_FUNC_TEST) {\n", + "\t\ttrace_array_put(this_tr);\n", + "\tmutex_unlock_pi;\n", "\n", - "bool __weak is_swbp_insn\n", - " * Returns:\n", - " *\tZero for success, 0 (invalid alignment with below mechanisms in the kprobe gone and remove\n", - " * @action: action to SIG_DFL for a signal frame,\n", - "\t and will be woken\n", - " * up from TASK_TRACED);\n", - "\tif (mod->state == MODULE_STATE_GOING:\n", - "\t\tstate = possible;\n", - "\t\t\tbreak;\n", - "\t\t\trest++;\n", - "\t\t}\n", - "\t\t/*\n", - "\t\t * Another cpu said 'go' */\n", - "\t\t/* Still using kdb, this problematic.\n", + "\t/*\n", + "\t * One idle CPUs. */\n", + "\tshuffle_intervals\n", + "\t * (think \"ticks\") worth of data\n", " */\n", - "void init_sched_dl_class(void)\n", + "static int func_id)\n", "{\n", - "\tfield_cachep = KMEM_CACHE(vm_area_struct *vma, struct autogroup *autogroup_kref_put(ag);\n", - "\n", - "\treturn 0;\n", + "\tswitch (ret) {\n", + "\t\t\tif (group_rq && (rt_rq_throttled;\n", "}\n", "\n", - "void do_raw_write_can_lock(l)\twrite_can_lock(l)\n", + "/**\n", + " * worker_clr_flags(worker, WORKER_PREP);\n", + "sleep:\n", + "\t/*\n", + "\t * In the semi idle case by checking on the CPU, it can't propagate the requeue\n", + " * @mode:\texpiry mode: absolute time */\n", + "\tif (ftrace_enabled) {\n", + "\t\t/* Keep track of cpu being initialization of architecture-specific fields. */\n", + "\tadd_taint(TAINT_LIVEPATCH\\n\");\n", + "\tadd_taint(TAINT_FORCED_MODULE))\n", + "\t\tbuf[l++] = 'E';\n", "\n", - "/*\n", - " * Software Foundation, and allows traversing */\n", - "static int perf_output_sample_rate __read_mostly futex_hash_bucket(futex));\n", - " * smp_mb() anyway for documentation of its parent\n", - "\t * using getname.\n", - " *\n", - " * default: 5 msec, units: microseconds, all such timers will fire\n", - " * at the end of this function implementation\n", - " * @num: number of tot\n" + "\trwbs[i] = '\\0';\n", + "\tif (count > 0) {\n", + "\t\terror = -EINVAL;\n", + "\t}\n", + "\n", + "\tif (prctl_map->__m1 __op\t\t\t\t\\\n", + "\t (unsigned long ticks)\n", + "{\n", + "\tjiffie\n" ] } ], @@ -742,7 +833,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 22, "metadata": { "collapsed": false, "jupyter": { @@ -755,49 +846,41 @@ "output_type": "stream", "text": [ "/*\n", - " * linux/kernel/irq/handle.c\n", + " * linux/kernel/timer.c.\n", + " * Please see that file for copyright and history logs.\n", " *\n", - " * Copyright (C) 2012 Dario Faggioli ,\n", - " * | |\\n\");\n", - "}\n", - "\n", - "static int __read_mostly =\n", - "{\n", - "\t.name\t\t= \"irqsoff\",\n", - "\t.init\t\t= preemptoff_tracer __read_mostly sysctl_hung_task_timeout_secs(struct ctl_table *table,\n", - "\t\t int write, void *data),\n", - "\t\t struct lock_list *unsafe_entry,\n", - "\t\t\tstruct lock_class_key irq_desc_lock_class;\n", - "\n", - "#if defined(CONFIG_RCU_TRACE */\n", - "\n", - "static __init int user_namespace *ns = task_active_pid_ns(parent));\n", - "\tinfo.si_uid = from_kuid_munged(current_user_ns(), task_uid(p));\n", - "\tstruct siginfo info;\n", - "\n", - "\tif (argc != 1)\n", - "\t\treturn -EINVAL;\n", - "\t}\n", - "#endif\n", - "\n", - "#ifdef CONFIG_SMP\n", - "\n", - "static void\n", - "irq_thread_check_affinity(struct rcu_node *rnp)\n", - "{\n", - "\treturn rnp->gp_tasks != NULL;\n", - "}\n", - "\n", - "/*\n", - " * return non-zero if there is a SIGKILL that should be deferred, ETT_NONE if nothing to defer.\n", " */\n", - "enum event_trigger_free() (see\n", - " *\ttrace_event_trigger_enable_disable(file, 0);\n", - "\t\t\tbreak;\n", - "\t\t}\n", "\n", - "\t\t/*\n", - "\t\t * Wait for all preempt-disabled section so we can as wel\n" + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#ifdef CONFIG_DEBUG_OBJECTS_RCU_HEAD kernel builds.\n", + " */\n", + "void destroy_rcu_head_on_stack(&rh1);\n", + "\tinit_rcu_head_on_stack(&rcu.head);\n", + "\tinit_completion(&self.exited);\n", + "\tinit_completion(&rcu.completion);\n", + "\n", + "\t/* Other rcu_barrier(). */\n", + "\t/* End of fields guarded by barrier_mutex. */\n", + "\n", + "\tatomic_long_t refs;\n", + "\tstruct rcu_node *rnp;\n", + "\n", + "\tif (t->rcu_read_lock_nesting, shared state will be updated only when filter_hash updating */\n", + "\t\tret = atomic_add_return(1, &rttest_event);\n", + "\t\ttd->mutexes[td->opdata] = 1;\n", + "\t\ttd->event = atomic_add_return(0, &rdp->dynticks->dynticks_nesting, rdtp->dyn\n" ] } ], @@ -808,7 +891,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 23, "metadata": { "collapsed": false, "jupyter": { @@ -821,33 +904,41 @@ "output_type": "stream", "text": [ "/*\n", - " * linux/kernel/itimer.c\n", + " * linux/kernel/irq/manage.c\n", " *\n", - " * Copyright (C) 2008 Red Hat, Inc., Peter Zijlstra \n", - " * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar \n", - " * Copyright (C) 2004 IBM Corporation\n", + " * Copyright (C) 2006 Timesys Corp., Thomas Gleixner\n", " *\n", - " * Author: Serge Hallyn \n", - " *\n", - " * This program is distributed in the hope that it will be useful,\n", - " * but WITHOUT ANY WARRANTY; without even the implied warranty of\n", - " * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n", - " * GNU General Public License as\n", - " * published by the Free Software Foundation; version 2\n", - " * of the License, or (at\n", - " * your option) any later version.\n", - " *\n", - " * This program is free software; you can redistribute it and/or\n", - " * modify it under the terms of the GNU GPL, version 2\n", - " *\n", - " * This file implements counting semaphores.\n", - " * A counting semaphore may be acquired 'n' times before sleeping.\n", - " * See mutex.c for single-acquisition sleeping locks which enforce\n", - " * rules which allow code to be debugged more easily.\n", + " * This code is licenced under the GPL version 2. For details see\n", + " * kernel-base/COPYING\n", " */\n", "\n", - "/*\n", - " * Some \n" + "#include \n", + "#include \n", + "#include \n", + "#include /* for spin_unlock_irq() using preempt_count() m68k */\n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "#include \n", + "\n", + "#include \"power.h\"\n", + "\n", + "static DEFINE_MUTEX(stop_cpus_mutex);\n", + "static DEFINE_SPINLOCK(rcu_torture_lock);\n", + "static DEFINE_PER_CPU(struct llist_head, call_single_queue);\n", + "\n", + "static void flush_module_icache(const struct module *mod,\n", + "\t\t\t const unsigned long seccomp_mode = SECCOMP_MODE_STRICT:\n", + "\t\top = SECCOMP_SET_MODE_FILTER:\n", + "\t\treturn __seccomp_phase1_filter(int this_syscall, struct seccomp_data *sd)\n", + "{\n", + "\tstruct seccomp_filter *walker;\n", + "\n", + "\tassert_spin_locked(¤t->sighand->siglock);\n", + "\tset_proces\n" ] } ], @@ -858,7 +949,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 24, "metadata": { "collapsed": false, "jupyter": { @@ -871,39 +962,42 @@ "output_type": "stream", "text": [ "/*\n", - " * linux/kernel/irq/manage.c\n", + " * linux/kernel/irq/autoprobe.c\n", " *\n", - " * Copyright (C) 2008-2014 Mathieu Desnoyers\n", - " *\n", - " * This program is distributed in the hope that it will be useful, but\n", - " * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n", - " * FITNESS FOR A PARTICULAR PURPOSE. See the\n", - " * GNU General Public Licence\n", - " * as published by the Free Software Foundation, version 2 of the\n", - " * License.\n", - " *\n", - " * Jun 2006 - namespaces support\n", - " * OpenVZ, SWsoft Inc.\n", - " * (C) 2007 Sukadev Bhattiprolu , IBM\n", - " * Many thanks to Oleg Nesterov for comments and help\n", + " * Copyright (C) 2003-2004 Amit S. Kale \n", + " * Copyright (C) 2012 Red Hat, Inc. All Rights Reserved.\n", " *\n", + " * This program is free software; you can redistribute it and/or modify\n", + " * it under the terms of the GNU General Public License version 2 as\n", + " * published by the Free Software Foundation.\n", " */\n", "\n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \t/* for cond_resched */\n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#include \n", - "#includ\n" + "#include \n", + "\n", + "#include \"trace.h\"\n", + "#include \"trace_output.h\"\n", + "\n", + "struct header_iter {\n", + "\tstruct pci_dev *dev;\n", + "};\n", + "\n", + "static struct rb_root swsusp_extents = RB_ROOT;\n", + "\n", + "static int swsusp_page_is_forbidden(page) && swsusp_page_is_free(virt_to_page(lp))) {\n", + "\t\t\t/* The page is \"safe\", add it to the list */\n", + "\t\t\tlp->next = safe_pages_list;\n", + "\t\tsafe_pages_list = safe_pages_list->next;\n", + "\tpbe->next = restore_pblist;\n", + "\trestore_pblist = NULL;\n", + "\tbuffer = NULL;\n", + "\talloc_normal = 0;\n", + "\talloc_highmem = 0;\n", + "\n", + "\t/* Count the number of saveable data pages. */\n", + "\tsave_highmem = count_highmem_image_pages - compute the total number of overruns from\n", + " */\n", + "unsigned long\n", + "ring\n" ] } ], @@ -913,7 +1007,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 25, "metadata": { "collapsed": false, "jupyter": { @@ -926,168 +1020,242 @@ "output_type": "stream", "text": [ "/*\n", - " * linux/kernel/irq/manage.c\n", + " * linux/kernel/irq/resend.c\n", " *\n", - " * Copyright (C) 2010 Red Hat, Inc.\n", + " * Copyright (C) 1997 Andrew Main \n", " *\n", - " * Note: Most of this code is borrowed heavily from the original softlockup\n", - " * detector, so thanks to Ingo for the initial implementation (includes suggestions from\n", - " *\t\tRusty Russell).\n", - " * 2004-Aug\tUpdated by Prasanna S Panchamukhi Changed Kprobes\n", - " *\t\texceptions notifier as suggested by Andi Kleen.\n", - " * 2004-July\tSuparna Bhattacharya added jumper probes\n", - " *\t\tinterface to access function arguments.\n", - " * 2004-Sep\tPrasanna S Panchamukhi\n", - " *\t\t with\n", - " *\t\thlists and exceptions notifier to be first on the priority list.\n", - " * 2005-May\tHien Nguyen , Jim Keniston\n", - " *\t\t and Prasanna S Panchamukhi Changed Kprobes\n", - " *\t\texceptions notifier as suggested by Andi Kleen.\n", - " * 2004-July\tSuparna Bhattacharya added function-return probe instances associated with the event\n", - " *\n", - " * If an event has triggers and any of those triggers has a filter or\n", - " * a post_trigger, trigger invocation is split\n", - " *\tin two - the first part checks the filter using the current\n", - " *\ttrace record; if a command has the @post_trigger flag set, it\n", - " *\tsets a bit for itself in the return value, otherwise it\n", - " *\tdirectly invokes the trigger. Once all commands have been\n", - " *\teither invoked or set their return flag, the current record function, skip it.\n", - " * If the ops ignores the function via notrace filter, skip it.\n", + " * Integrated into 2.1.97+, Andrew G. Morgan \n", + " * 30 May 2002:\tCleanup, Robert M. Love \n", " */\n", - "static inline void\n", - "__sched_info_switch(struct rq *rq, struct task_struct *p;\n", - "\tint retval;\n", "\n", - "\tif (!desc || !irqd_can_balance(&desc->irq_data)) {\n", - "\t\t/*\n", - "\t\t * Already running: If it is shared get the other\n", - "\t\t * CPU to go looking for our mystery interrupt too\n", - "\t\t */\n", - "\t\tdesc->istate |= IRQS_SUSPENDED;\n", - "\t__disable_irq(desc, irq);\n", - "out:\n", - "\tirq_put_desc_busunlock(desc, flags);\n", - "\treturn err;\n", + "#define pr_fmt(fmt) KBUILD_MODNAME \": \" fmt\n", + "\n", + "#include \n", + "#include \n", + "#include \"cpudeadline.h\"\n", + "#include \"cpuacct.h\"\n", + "\n", + "struct rq;\n", + "struct cpuidle_state *idle_state)\n", + "{\n", + "\trq->idle_state = idle_state;\n", "}\n", + "\n", + "static inline struct cpuacct *css_ca(struct cgroup_subsys *ss;\n", + "\tint i;\n", + "\n", + "\tinit_cgroup_root(&cgrp_dfl_root, &opts);\n", + "\tcgrp_dfl_root.cgrp.self.flags |= CSS_NO_REF;\n", + "\n", + "\tif (early) {\n", + "\t\t/* allocation can't be done safely during early init */\n", + "\t\tcss->id = 1;\n", + "\t} else {\n", + "\t\tcss->id = cgroup_idr_alloc(&ss->css_idr, css, 1, 2,\n", + "\t\t\t\t\t\t GFP_KERNEL);\n", + "\tif (!data)\n", + "\t\tgoto out;\n", + "\n", + "\tcd->fp = fp;\n", + "\tcd->clk = get_posix_clock(fp);\n", + "\tint err = -ENODEV;\n", + "\n", + "\tif (cnt >= PAGE_SIZE)\n", + "\t\treturn -EINVAL;\n", + "\trcu_read_lock();\n", + "\tsd = rcu_dereference(per_cpu(sd_asym, cpu), sd);\n", + "}\n", + "\n", "/*\n", - " * RT-Mutexes: blocking mutual exclusion locks with PI support\n", - " *\n", - " * started by Ingo Molnar and Thomas Gleixner:\n", - " *\n", - " * Copyright (C) 1991, 1992 Linus Torvalds\n", - " *\n", - " * Modified to make sys_syslog() more flexible: added commands to\n", - " * return the last 4k of kernel messages, regardless of whether\n", - " * they've been read or not. Added option to suppress kernel printk's\n", - " * to the console. Added hook for sending the console messages\n", - " * elsewhere, in preparation for detecting the next grace period.\n", - "\t * But we can only be sure that RCU is idle if we are looking\n", - "\t * at the root rcu_node structure's lock in order to\n", - "\t * start one (if needed).\n", - "\t */\n", - "\tif (rnp != rnp_root) {\n", - "\t\traw_spin_lock(&ctx->lock);\n", + " * Attach the domain 'sd' to 'cpu' as its base domain. Callers must\n", + " * hold the hotplug lock.\n", + " * For now this just excludes isolated cpus, but could be used to\n", + " * exclude other special cases in the future.\n", + " */\n", + "void nohz_balance_enter_idle(int cpu)\n", + "{\n", + "\t/*\n", + "\t * Make sure legacy kernel users don't send in bad values\n", + "\t * (normal paths check this in check_kill_permission(int sig, struct k_sigaction *ka;\n", + "\n", + "\t\tif (unlikely(current->lockdep_recursion = 1;\n", + "\t__trace_hardirqs_on_caller(CALLER_ADDR0);\n", + "}\n", + "EXPORT_SYMBOL(default_wake_function(wait, mode, sync, key);\n", "}\n", "\n", - "static inline void debug_init(struct timer_list *timer, void (*fn)(unsigned long),\n", - "\t\t\t\ti == entry->nb_args - 1 ? \"\" : \", \");\n", - "\t}\n", - "\tpos += snprintf(buf + pos, LEN_OR_ZERO, \" %s=%s\",\n", - "\t\t\t\ttp->args[i].name);\n", - "\t}\n", + "void __wake_up_parent(struct task_struct *\n", + "pick_next_task_stop(struct rq *rq)\n", + "{\n", + "}\n", "\n", - "#undef LEN_OR_ZERO\n", + "static inline void dl_clear_overload(struct rq *rq)\n", + "{\n", + "\treturn atomic_read(&mod->refcnt) - MODULE_REF_BASE;\n", + "}\n", + "EXPORT_SYMBOL(mod_timer_pinned);\n", "\n", - "\t/* return the length of the given event. Will return\n", - " * the length of the time extend if the event is a\n", - " * time extend.\n", + "/**\n", + " * add_timer - start a timer\n", + " * @timer: the timer to be initialized\n", + " *\n", + " * This function can be called from any context.\n", " */\n", - "static inline void register_handler_proc(irq, new);\n", - "\tfree_cpumask_var(mask);\n", + "void audit_log_untrustedstring(ab, get_task_comm(comm, current));\n", + "\taudit_log_untrustedstring(ab, get_task_comm(comm, tsk));\n", + "\n", + "\taudit_log_d_path_exe(struct audit_buffer *ab, __u32 portid)\n", + "{\n", + "\tif (ab) {\n", + "\t\tstruct nlmsghdr *nlh;\n", + "\t/*\n", + "\t * len MUST be signed for nlmsg_next to be able to dec it below 0\n", + "\t * if the nlmsg_len was not aligned\n", + "\t */\n", + "\tint len;\n", + "\tint err;\n", + "\n", + "\tnlh = nlmsg_put(ab->skb, 0, 0, type, 0, 0);\n", + "\tif (!nlh)\n", + "\t\tgoto out_kfree_skb;\n", + "\n", + "\treturn ab;\n", + "\n", + "out_kfree_skb:\n", + "\tkfree_skb(skb);\n", + "\treturn NULL;\n", + "}\n", + "\n", + "static struct ftrace_ops global_ops = {\n", + "\t.func\t\t\t= event_enable_count_trigger_ops = {\n", + "\t.func\t\t\t= ftrace_traceon_print,\n", + "};\n", + "\n", + "static struct kobj_attribute *attr,\n", + "\t\t\t char *buf)\n", + "{\n", + "\treturn sprintf(buffer, \"%i\\n\", module_refcount(mod));\n", + "\n", + "\t/*\n", + "\t * Always include a trailing , so userspace can differentiate\n", + "\t * between this and the old multi-field proc format.\n", + "\t */\n", + "\tlist_for_each_entry(tr, &ftrace_trace_arrays, list) {\n", + "\t\tlist_for_each_entry(event, &parent_ctx->pinned_groups, group_entry) {\n", + "\t\tret = inherit_task_group(event, parent, parent_ctx,\n", + "\t\t\t child, child_ctx);\n", + "\n", + "\tif (ret)\n", + "\t\t*inherited_all = 0;\n", + "\t\treturn 0;\n", + "\t}\n", + "\t\n", + "\ti = (int *) tbl_data;\n", + "\tvleft = table->maxlen / sizeof(*i);\n", + "\tleft = *lenp;\n", + "\n", + "\tif (!conv)\n", + "\t\tconv = do_proc_dointvec_conv;\n", + "\n", + "\tif (write) {\n", + "\t\tif (sysctl_writes_strict = SYSCTL_WRITES_WARN)\n", + "\t\twarn_sysctl_write(table);\n", + "\t\t\t\tbreak;\n", + "\t\t\tdefault:\n", + "\t\t\t\tWARN_ON_ONCE(1);\n", + "\t\treturn PTR_ERR(old);\n", + "\t}\n", + "\n", + "\tif (!tp_funcs) {\n", + "\t\t/* Removed last function */\n", + "\t\tif (tp->unregfunc && static_key_enabled(key);\n", + "\n", + "\tif ((!true_branch && state) || (true_branch && !state))\n", + "\t\treturn JUMP_LABEL_ENABLE;\n", + "\n", + "\treturn JUMP_LABEL_DISABLE;\n", + "}\n", + "\n", + "void __init jump_label_init(void)\n", + "{\n", + "\tstruct dentry *d = kern_path_locked(watch->path, parent);\n", + "\tif (IS_ERR(tg))\n", + "\t\treturn ERR_PTR(-ENOTDIR);\n", + "\tctl_name = *name;\n", + "\tname++;\n", + "\tnlen--;\n", + "\tfor ( ; table->convert; table++) {\n", + "\t\tint len = 0;\n", + "\n", + "\t\t/*\n", + "\t\t * For a wild card entry map from ifindex to network\n", + "\t\t * device name.\n", + "\t\t */\n", + "\t\tif (!table->ctl_name) {\n", + "#ifdef CONFIG_NET\n", + "\t.net_ns\t\t\t= &init_net,\n", + "#endif\n", + "};\n", + "\n", + "static struct miscdevice snapshot_device = {\n", + "\t.minor = SNAPSHOT_MINOR,\n", + "\t.name = \"snapshot\",\n", + "\t.fops = &snapshot_fops,\n", + "};\n", + "\n", + "static int __init sched_clock_postinit(void)\n", + "{\n", + "\t/*\n", + "\t * If there is an existing filter, make it the prev and don't drop its\n", + "\t * task reference.\n", + "\t */\n", + "\tfilter->prev = current->seccomp.mode && current->seccomp.mode != seccomp_mode)\n", + "\t\treturn false;\n", + "\n", + "\tif ((sgs->group_capacity * 100) >\n", + "\t\t\t(sgs->group_usage * env->sd->imbalance_pct))\n", + "\t\treturn true;\n", + "\n", + "\treturn false;\n", + "}\n", + "\n", + "static bool klp_initialized(void)\n", + "{\n", + "\treturn klp_root_kobj;\n", + "}\n", + "\n", + "struct klp_find_arg *args = data;\n", + "\n", + "\tif (!mod &&\n", + "\t !strcmp(args->name, name) &&\n", + "\t args->addr == addr)\n", + "\t\treturn 1;\n", "\n", "\treturn 0;\n", "}\n", "\n", - "#ifdef CONFIG_COMPAT\n", - "static long posix_cpu_nsleep_restart(struct restart_block *restart)\n", + "static struct ftrace_ops *ops)\n", "{\n", - "\tenum alarmtimer_type type,\n", - "\t\t\tstruct pid *new)\n", - "{\n", - "\tstruct pid_link *links)\n", - "{\n", - "\tenum pid_type type;\n", + "\tint __percpu *disabled;\n", "\n", - "\tfor (type = PIDTYPE_PID; type < PIDTYPE_MAX; ++type) {\n", - "\t\tINIT_HLIST_NODE(&ri->hlist);\n", - "\t\tkretprobe_table_unlock(hash, &flags);\n", - "\t\thlist_add_head(&inst->hlist, &rp->free_instances);\n", + "\tdisabled = alloc_percpu(int);\n", + "\tif (!disabled)\n", + "\t\treturn -EINVAL;\n", + "\n", + "\tif (vma_size != PAGE_SIZE * (1 + nr_pages))\n", + "\t\treturn -EINVAL;\n", "\t}\n", - "\n", - "\trp->nmissed = 0;\n", - "\t/* Establish function entry probe to avoid possible hanging */\n", - "static int trace_test_buffer_cpu(buf, cpu);\n", - "\t\tif (ret)\n", - "\t\t\tbreak;\n", + "\tif (insn->off != 0) {\n", + "\t\t\t\tverbose(\"BPF_END uses reserved fields\\n\");\n", + "\t\t\t\treturn -EINVAL;\n", + "\t\t}\n", + "\t\tp[AUDIT_WORD(n)] |= AUDIT_BIT(n);\n", "\t}\n", - "\n", - "\t/*\n", - "\t * We can't hold ctx->lock when iterating the ->flexible_group list due\n", - "\t * to allocations, but we need to prevent that we loop forever in the hrtimer\n", - "\t * interrupt routine. We give it 3 attempts to avoid\n", - "\t * overreacting on some spurious event.\n", - "\t *\n", - "\t * Acquire base lock for updating the offsets and retrieving\n", - "\t * the current rq->clock timestamp, except that would require using\n", - "\t * atomic ops.\n", - "\t */\n", - "\tif (irq_delta > delta)\n", - "\t\tirq_delta = delta;\n", - "\n", - "\trq->prev_irq_time += irq_delta;\n", - "\tdelta -= irq_delta;\n", - "#endif\n", - "#ifdef CONFIG_NO_HZ_FULL\n", - "static void nohz_kick_work_fn(struct work_struct *work)\n", - "{\n", - "\tsmp_wmb();\t/* see set_work_pool_and_clear_pending(work, pool->id);\n", - "\n", - "\t\tspin_unlock(&pool->lock);\n", - "\t/* see the comment above the definition of WQ_POWER_EFFICIENT */\n", - "#ifdef CONFIG_WQ_POWER_EFFICIENT_DEFAULT\n", - "static bool wq_power_efficient;\n", - "#endif\n", - "\n", - "module_param_named(cmd_enable, kdb_cmd_enabled, int, 0600);\n", - "\n", - "char kdb_grep_string[];\n", - "#define KDB_GREP_STRLEN 256\n", - "extern int kdb_grep_trailing;\n", - "extern char *kdb_cmds[];\n", - "extern unsigned int max_bfs_queue_depth;\n", - "\n", - "static unsigned int relay_file_poll(struct file *file, const char __user *ubuf,\n", - "\t\t size_t cnt, loff_t *ppos)\n", - "{\n", - "\treturn -ENOSYS;\n", - "}\n", - "\n", - "int proc_dointvec_jiffies,\n", - "\t},\n", - "\t{\n", - "\t\t.procname\t= \"sched_cfs_bandwidth_slice(void)\n", - "{\n", - "\treturn ((trace_type & TRACER_IRQS_OFF) &&\n", - "\t\tirqs_disabled());\n", - "}\n", - "#else\n", - "# define perf_compat_ioctl NULL\n", - "#endif\n", - "\n", - "int perf_event_task_disable(void)\n", - "{\n", - "\tstruct trace_buffer\ttrace_buffer;\n", - "#ifdef CONFIG_TR\n" + "\tif (class >= AUDIT_SYSCALL_CLASSES) {\n", + "\t\t\tkfree(p);\n", + "\t\t\treturn -EINVAL;\n", + "\t/* FALL THROUGH */\n", + "\tcase AUDIT\n" ] } ],