From: Punit Agrawal <punit.agrawal@arm.com>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: mark.rutland@arm.com, David Woods <dwoods@mellanox.com>,
Steve Capper <steve.capper@arm.com>,
will.deacon@arm.com, linux-mm@kvack.org,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v6 4/9] arm64: hugetlb: Add break-before-make logic for contiguous entries
Date: Fri, 18 Aug 2017 13:48:56 +0100 [thread overview]
Message-ID: <87o9rdnirr.fsf@e105922-lin.cambridge.arm.com> (raw)
In-Reply-To: <20170818104327.a5yep2p3ntjbffug@armageddon.cambridge.arm.com> (Catalin Marinas's message of "Fri, 18 Aug 2017 11:43:28 +0100")
Catalin Marinas <catalin.marinas@arm.com> writes:
> On Fri, Aug 18, 2017 at 11:30:22AM +0100, Punit Agrawal wrote:
>> Catalin Marinas <catalin.marinas@arm.com> writes:
>>
>> > On Thu, Aug 10, 2017 at 06:09:01PM +0100, Punit Agrawal wrote:
>> >> --- a/arch/arm64/mm/hugetlbpage.c
>> >> +++ b/arch/arm64/mm/hugetlbpage.c
>> >> @@ -68,6 +68,62 @@ static int find_num_contig(struct mm_struct *mm, unsigned long addr,
>> >> return CONT_PTES;
>> >> }
>> >>
>> >> +/*
>> >> + * Changing some bits of contiguous entries requires us to follow a
>> >> + * Break-Before-Make approach, breaking the whole contiguous set
>> >> + * before we can change any entries. See ARM DDI 0487A.k_iss10775,
>> >> + * "Misprogramming of the Contiguous bit", page D4-1762.
>> >> + *
>> >> + * This helper performs the break step.
>> >> + */
>> >> +static pte_t get_clear_flush(struct mm_struct *mm,
>> >> + unsigned long addr,
>> >> + pte_t *ptep,
>> >> + unsigned long pgsize,
>> >> + unsigned long ncontig)
>> >> +{
>> >> + unsigned long i, saddr = addr;
>> >> + struct vm_area_struct vma = { .vm_mm = mm };
>> >> + pte_t orig_pte = huge_ptep_get(ptep);
>> >> +
>> >> + /*
>> >> + * If we already have a faulting entry then we don't need
>> >> + * to break before make (there won't be a tlb entry cached).
>> >> + */
>> >> + if (!pte_present(orig_pte))
>> >> + return orig_pte;
>> >
>> > I first thought we could relax this check to pte_valid() as we don't
>> > care about the PROT_NONE case for hardware page table updates. However,
>> > I realised that we call this where we expect the pte to be entirely
>> > cleared but we simply skip it if !present (e.g. swap entry). Is this
>> > correct?
>>
>> I've checked back and come to the conclusion that get_clear_flush() will
>> not get called with swap entries.
>>
>> In the case of huge_ptep_get_and_clear() below, the callers
>> (__unmap_hugepage_range() and hugetlb_change_protection()) check for
>> swap entries before calling. Similarly
>>
>> I'll relax the check to pte_valid().
>
> Thanks for checking but I would still keep the semantics of the generic
> huge_ptep_get_and_clear() where the entry is always zeroed. It shouldn't
> have any performance impact since this function won't be called for swap
> entries, but just in case anyone changes the core code later on.
Makes sense. I'll drop the check and unconditionally clear the entries.
--
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 prev parent reply other threads:[~2017-08-18 12:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-10 17:08 [PATCH v6 0/9] arm64: Enable contiguous pte hugepage support Punit Agrawal
2017-08-10 17:08 ` [PATCH v6 1/9] arm64: hugetlb: set_huge_pte_at Add WARN_ON on !pte_present Punit Agrawal
2017-08-10 17:08 ` [PATCH v6 2/9] arm64: hugetlb: Introduce pte_pgprot helper Punit Agrawal
2017-08-10 17:09 ` [PATCH v6 3/9] arm64: hugetlb: Spring clean huge pte accessors Punit Agrawal
2017-08-10 17:09 ` [PATCH v6 4/9] arm64: hugetlb: Add break-before-make logic for contiguous entries Punit Agrawal
2017-08-17 18:03 ` Catalin Marinas
2017-08-18 10:30 ` Punit Agrawal
2017-08-18 10:43 ` Catalin Marinas
2017-08-18 12:48 ` Punit Agrawal [this message]
2017-08-10 17:09 ` [PATCH v6 5/9] arm64: hugetlb: Handle swap entries in huge_pte_offset() for contiguous hugepages Punit Agrawal
2017-08-18 11:20 ` Catalin Marinas
2017-08-18 13:49 ` Punit Agrawal
2017-08-10 17:09 ` [PATCH v6 6/9] arm64: hugetlb: Override huge_pte_clear() to support " Punit Agrawal
2017-08-10 17:09 ` [PATCH v6 7/9] arm64: hugetlb: Override set_huge_swap_pte_at() " Punit Agrawal
2017-08-10 17:09 ` [PATCH v6 8/9] arm64: Re-enable support for " Punit Agrawal
2017-08-10 17:09 ` [PATCH v6 9/9] arm64: hugetlb: Cleanup setup_hugepagesz Punit Agrawal
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=87o9rdnirr.fsf@e105922-lin.cambridge.arm.com \
--to=punit.agrawal@arm.com \
--cc=catalin.marinas@arm.com \
--cc=dwoods@mellanox.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-mm@kvack.org \
--cc=mark.rutland@arm.com \
--cc=steve.capper@arm.com \
--cc=will.deacon@arm.com \
/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