From: "Hillf Danton" <hillf.zj@alibaba-inc.com>
To: Aneesh Kumar <aneesh.kumar@linux.vnet.ibm.com>
Cc: linux-kernel <linux-kernel@vger.kernel.org>, linux-mm@kvack.org
Subject: Re: [RFC PATCH 2/4] mm: Change the interface for __tlb_remove_page
Date: Mon, 30 May 2016 16:07:31 +0800 [thread overview]
Message-ID: <001901d1ba4a$514eccc0$f3ec6640$@alibaba-inc.com> (raw)
In-Reply-To: <001701d1ba44$b9c0d560$2d428020$@alibaba-inc.com>
> diff --git a/mm/memory.c b/mm/memory.c
> index 15322b73636b..a01db5bc756b 100644
> --- a/mm/memory.c
> +++ b/mm/memory.c
> @@ -292,23 +292,24 @@ void tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long e
> * handling the additional races in SMP caused by other CPUs caching valid
> * mappings in their TLBs. Returns the number of free page slots left.
> * When out of page slots we must call tlb_flush_mmu().
> + *returns true if the caller should flush.
> */
> -int __tlb_remove_page(struct mmu_gather *tlb, struct page *page)
> +bool __tlb_remove_page(struct mmu_gather *tlb, struct page *page)
> {
> struct mmu_gather_batch *batch;
>
> VM_BUG_ON(!tlb->end);
>
> batch = tlb->active;
> - batch->pages[batch->nr++] = page;
> if (batch->nr == batch->max) {
> if (!tlb_next_batch(tlb))
> - return 0;
> + return true;
> batch = tlb->active;
> }
> VM_BUG_ON_PAGE(batch->nr > batch->max, page);
Still needed?
>
> - return batch->max - batch->nr;
> + batch->pages[batch->nr++] = page;
> + return false;
> }
>
> #endif /* HAVE_GENERIC_MMU_GATHER */
> @@ -1109,6 +1110,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
> pte_t *start_pte;
> pte_t *pte;
> swp_entry_t entry;
> + struct page *pending_page = NULL;
>
> again:
> init_rss_vec(rss);
> @@ -1160,8 +1162,9 @@ again:
> page_remove_rmap(page, false);
> if (unlikely(page_mapcount(page) < 0))
> print_bad_pte(vma, addr, ptent, page);
> - if (unlikely(!__tlb_remove_page(tlb, page))) {
> + if (unlikely(__tlb_remove_page(tlb, page))) {
> force_flush = 1;
> + pending_page = page;
> addr += PAGE_SIZE;
> break;
> }
> @@ -1202,7 +1205,12 @@ again:
> if (force_flush) {
> force_flush = 0;
> tlb_flush_mmu_free(tlb);
> -
> + if (pending_page) {
> + /* remove the page with new size */
> + __tlb_adjust_range(tlb, tlb->addr);
Would you please specify why tlb->addr is used here?
thanks
Hillf
> + __tlb_remove_page(tlb, pending_page);
> + pending_page = NULL;
> + }
> if (addr != end)
> goto again;
> }
> --
> 2.7.4
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next parent reply other threads:[~2016-05-30 8:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <001701d1ba44$b9c0d560$2d428020$@alibaba-inc.com>
2016-05-30 8:07 ` Hillf Danton [this message]
2016-05-30 15:34 ` [RFC PATCH 2/4] mm: Change the interface for __tlb_remove_page Aneesh Kumar K.V
2016-05-31 3:52 ` Hillf Danton
2016-05-31 6:50 ` Aneesh Kumar K.V
2016-05-31 7:26 ` Hillf Danton
2016-05-30 5:44 [RFC PATCH 1/4] mm/hugetlb: Simplify hugetlb unmap Aneesh Kumar K.V
2016-05-30 5:44 ` [RFC PATCH 2/4] mm: Change the interface for __tlb_remove_page Aneesh Kumar K.V
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='001901d1ba4a$514eccc0$f3ec6640$@alibaba-inc.com' \
--to=hillf.zj@alibaba-inc.com \
--cc=aneesh.kumar@linux.vnet.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).