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 19:22:10 +0100
From:   Matthew Wilcox <willy@...radead.org>
To:     Yang Shi <shy828301@...il.com>
Cc:     hughd@...gle.com, jhubbard@...dia.com,
        kirill.shutemov@...ux.intel.com, vbabka@...e.cz,
        akpm@...ux-foundation.org, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH] mm: dump_page: print total mapcount for compound page

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.

> +		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.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ