LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   Cramming page metadata into struct page (https://www.linuxquestions.org/questions/linux-kernel-70/cramming-page-metadata-into-struct-page-4175669534/)

danielNJ 02-13-2020 09:25 AM

Cramming page metadata into struct page
 
I asked this same question on stack overflow (here), but haven't gotten any responses. Here is my question:

I am looking at the definition of
Code:

struct page
in the file linux/mm_types.h. My question is in regards to the comment at the top of the definition:
Code:

struct page {
        unsigned long flags;                /* Atomic flags, some possibly
                                                * updated asynchronously */
        /*
        * Five words (20/40 bytes) are available in this union.
        * WARNING: bit 0 of the first word is used for PageTail(). That
        * means the other users of this union MUST NOT use the bit to
        * avoid collision and false-positive PageTail().
        */

If I want to use these 20 bytes to store metadata about a page, how would I do so? Is there anything that I would need to check before overwriting those addresses, so that I don't corrupt any valid data that was supposed to be there?


All times are GMT -5. The time now is 03:29 PM.