lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 28 May 2021 11:56:59 -0700
From:   Yang Shi <shy828301@...il.com>
To:     Matthew Wilcox <willy@...radead.org>
Cc:     Hugh Dickins <hughd@...gle.com>,
        John Hubbard <jhubbard@...dia.com>,
        "Kirill A. Shutemov" <kirill.shutemov@...ux.intel.com>,
        Vlastimil Babka <vbabka@...e.cz>,
        Andrew Morton <akpm@...ux-foundation.org>,
        Linux MM <linux-mm@...ck.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH] mm: dump_page: print total mapcount for compound page

On Fri, May 28, 2021 at 11:22 AM Matthew Wilcox <willy@...radead.org> wrote:
>
> On Fri, May 28, 2021 at 10:54:03AM -0700, Yang Shi wrote:
> > So I prepared this patch to show a possible approach to get some
> > feedback.  The same thing could be decoded by the reader of page dump
> > as well by using the same formula used by this patch.  However it sounds
> > more convenient to have kernel do the math.
>
> You haven't taken enough things into consideration ...
>
> > +     bool is_slab = PageSlab(head);
>
> We should probably have a separate dump_slab_page().  Almost nothing
> in __dump_page() is really useful for slab pages (eg, mapping, index,
> mapcount, compound_mapcount, compound_pincount, aops), and the flags
> (such as are used) have different meanings.

Yes, slab page dump is missed for a long time.

>
> > +             nr = compound_nr(head);
> > +             if (is_slab)
> > +                     total_mapcount = 0;
> > +             else if (PageHuge(head))
> > +                     total_mapcount = comp_mapcnt;
> > +             else {
> > +                     if (mapping) {
> > +                             if (!PageAnon(head))
> > +                                     nr = nr * (comp_mapcnt + 1) - comp_mapcnt;
> > +                     } else
> > +                             nr = 0;
> > +                     total_mapcount = refcount - pincount - nr;
>
> I see what you're trying to do here, but there are so many other things
> which take a refcount on a page.  The LRU, the page cache, private fs
> data, random temporary "gets" (eg, buffered reads, buffered writes,
> get_user_pages(), readahead, truncate, migration).  I think this is
> likely to be so inaccurate as to be confusing.

Yes, it is inaccurate in some cases. There is not a simple way to rule
out those random transient references. The page cache has been taken
into account by this patch, but I overlooked private page and LRU
cache cases, they seem simple to filter out by page flags.

>
> I had to think hard about it though.  I like what you're trying to do,
> I just don't think it works ;-(

The random transient references are annoying and could make the number
be far away from accuracy. That would be too confusing to be worth
printing the number. But I'm not sure how often or bad it could be.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ