Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1263184
| From | Vladimir Davydov <vdavydov@virtuozzo.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting |
| Date | 2015-11-05 14:00 +0100 |
| Message-ID | <qrsiZ-6OG-5@gated-at.bofh.it> (permalink) |
| References | (1 earlier) <qqLH5-4sG-47@gated-at.bofh.it> <qroS6-4FF-17@gated-at.bofh.it> <qrp1M-4Jn-9@gated-at.bofh.it> <qrrwB-6v5-9@gated-at.bofh.it> <qrrZE-6Hq-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Thu, Nov 05, 2015 at 02:36:06PM +0200, Kirill A. Shutemov wrote:
> On Thu, Nov 05, 2015 at 03:07:26PM +0300, Vladimir Davydov wrote:
> > @@ -849,30 +836,23 @@ static int page_referenced_one(struct page *page, struct vm_area_struct *vma,
> > if (pmd_page(*pmd) != page)
> > goto unlock_pmd;
> >
> > - if (vma->vm_flags & VM_LOCKED) {
> > - pra->vm_flags |= VM_LOCKED;
> > - ret = SWAP_FAIL; /* To break the loop */
> > - goto unlock_pmd;
> > - }
> > -
> > - if (pmdp_clear_flush_young_notify(vma, address, pmd))
> > - referenced++;
> > - spin_unlock(ptl);
> > + pte = (pte_t *)pmd;
>
> pmd_t and pte_t are not always compatible. We shouldn't pretend they are.
> And we shouldn't use pte_unmap_unlock() to unlock pmd table.
Out of curiosity, is it OK that __page_check_address can call
pte_unmap_unlock on pte returned by huge_pte_offset, which isn't really
pte, but pmd or pud?
>
> What about interface like this (I'm not sure about helper's name):
>
> void page_check_address_transhuge(struct page *page, struct mm_struct *mm,
> unsigned long address,
> pmd_t **pmdp, pte_t **ptep,
> spinlock_t **ptlp);
>
> page_check_address_transhuge(page, mm, address, &pmd, &pte, &ptl);
> if (pmd) {
> /* handle pmd... */
> } else if (pte) {
> /* handle pte... */
> } else {
> return SWAP_AGAIN;
> }
>
> /* common stuff */
>
> if (pmd)
> spin_unlock(ptl);
> else
> pte_unmap_unlock(pte, ptl);
spin_unlock(ptl);
if (pte)
pte_unmap(pte);
would look neater IMO. Other than that, I think it's OK. At least, it
looks better and less error-prone than duplicating such a huge chunk of
code IMO.
Thanks,
Vladimir
>
> /* ... */
>
> The helper shouldn't set pmd if the page is tracked to pte.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4] Bugfixes for THP refcounting "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2015-11-03 16:30 +0100
[PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2015-11-03 16:30 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting Vladimir Davydov <vdavydov@virtuozzo.com> - 2015-11-05 10:20 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-11-05 10:30 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting Vladimir Davydov <vdavydov@virtuozzo.com> - 2015-11-05 13:10 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-11-05 13:40 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-11-05 14:00 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting Vladimir Davydov <vdavydov@virtuozzo.com> - 2015-11-05 17:40 +0100
[PATCH] mm: add page_check_address_transhuge helper Vladimir Davydov <vdavydov@virtuozzo.com> - 2015-11-06 15:40 +0100
Re: [PATCH] mm: add page_check_address_transhuge helper "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-11-06 16:30 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting Vladimir Davydov <vdavydov@virtuozzo.com> - 2015-11-05 14:00 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting Vladimir Davydov <vdavydov@virtuozzo.com> - 2015-11-05 17:10 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-11-05 18:30 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting Andrew Morton <akpm@linux-foundation.org> - 2015-11-06 01:40 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-11-06 11:30 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting Andrew Morton <akpm@linux-foundation.org> - 2015-11-06 23:40 +0100
Re: [PATCH 4/4] mm: prepare page_referenced() and page_idle to new THP refcounting "Kirill A. Shutemov" <kirill@shutemov.name> - 2015-11-09 00:50 +0100
[PATCH 2/4] mm: duplicate rmap reference for hugetlb pages as compound "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2015-11-03 16:30 +0100
[PATCH 3/4] thp: fix split vs. unmap race "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com> - 2015-11-03 16:30 +0100
csiph-web