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]
Message-ID: <27f7b8c52e2da5e8003de2226bff181fdc7a7f69@linux.dev>
Date:   Thu, 09 Nov 2023 15:43:10 +0000
From:   jeff.xie@...ux.dev
To:     "Matthew Wilcox" <willy@...radead.org>
Cc:     akpm@...ux-foundation.org, iamjoonsoo.kim@....com, vbabka@...e.cz,
        cl@...ux.com, penberg@...nel.org, rientjes@...gle.com,
        roman.gushchin@...ux.dev, 42.hyeyoo@...il.com, linux-mm@...ck.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        chensong_2000@....cn, xiehuan09@...il.com
Subject: Re: [RFC][PATCH 3/4] filemap: implement filemap allocate post
 callback for page_owner

November 9, 2023 at 10:09 PM, "Matthew Wilcox" <willy@...radead.org> wrote:


> 
> On Thu, Nov 09, 2023 at 11:25:20AM +0800, Jeff Xie wrote:
> 
> > 
> > +static int filemap_alloc_post_page_owner(struct folio *folio, struct task_struct *tsk,
> >  + void *data, char *kbuf, size_t count)
> >  +{
> >  + int ret;
> >  + int mapcount;
> >  + dev_t s_dev;
> >  + struct inode *inode;
> >  + struct vm_area_struct *vma;
> >  + struct mm_struct *mm;
> >  + unsigned long virtual_start = 0x0;
> >  + unsigned long virtual_end = 0x0;
> >  + struct address_space *mapping = data;
> > 
> 
> This is just folio->mapping.

Thanks, I need to know more about struct folio ;-)

> 
> > 
> > + mapcount = folio_mapcount(folio);
> >  + if (mapcount && tsk && tsk->mm) {
> >  + mm = tsk->mm;
> >  + VMA_ITERATOR(vmi, mm, 0);
> >  + mmap_read_lock(mm);
> >  + for_each_vma(vmi, vma) {
> >  + if (page_mapped_in_vma(&folio->page, vma)) {
> >  + virtual_start = vma_address(&folio->page, vma);
> >  + virtual_end = virtual_start + folio_nr_pages(folio) * PAGE_SIZE;
> >  + break;
> >  + }
> >  + }
> >  + mmap_read_unlock(mm);
> >  + }
> > 
> 
> Why not just walk the rmap directly to find out where it's mapped in
> any process instead of the one which allocated it?

Since the page_owner's result only shows which PID allocated this page, we only need to obtain the address space of the corresponding process for that PID.

--
Jeff Xie

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ