…but then you try to explain it to someone else. If, like me, you find yourself in that moment with your mouth hanging open and nothing coming out, you know you have some studying to do.
Early on, my mentor made a page for me at linux-mm.org (look only if you dare) and suggested I post my observations and questions there for discussion. Once I had amassed enough, he gave me the goahead to spin off chunks into standalone articles that, hopefully (at least as far as I’m concerned), will become part of the site’s content. Half hour job, I thought. Just a matter of cutting, pasting and polishing, I thought.
Well, I knew for example that the swapin code fetched some pages in a loop and pre-loaded them into the page cache before it fetched the page that is to be swapped in, and I knew it called a function called read_swap_cache_async() to fetch each one. I knew read_swap_cache_async had a bunch of steps in it, that it double checked the swap cache, allocated a page for the page, and stuff. I couldn’t put “and stuff” in the article. I went back over my notes to find the explanation, so I could copy and paste it in, even though I already knew it wouldn’t be there.
It was now time to sit down and think about the problem clearly. As I reconstructed the call stack bit by bit, I not only filled in the missing parts, I took note of the patterns to them. I’d know the order of the function calls and roughly what each function did, but I couldn’t remember their parameters or return types, meaning I wasn’t clear on their relationships. I found the same function called as part of both the swapout and swapin chains, meaning that while I was aware of the function’s actions, its purpose was lost on me. Lines that I overlooked the first time, but which were actually the most important ones, jumped out at me.
It was tedious and time consuming, but I’m glad to have done it. I’m always glad to improve my understanding of the kernel, but especially, I’m glad I exposed my learning process to myself so that I can restructure it. I had, without being aware of it, been expecting my subconscious to integrate the information I took in. That worked back when the problems I faced were simpler. To go to the next level, I need to be able to consciously control the process.
I see exactly why my mentor wants me to write all this out. It’s the same rationale behind rubber ducking, keeping a journal, and working every step of a math problem with pencil and paper. True knowledge has structure, and the structure is the same whether it’s inside or outside your head. Inside your head, it can get lost in darkness and fog. Taking it outside your head shines the sunlight on it.