2005-09-07 02:35:46

by Zhang, Yanmin

[permalink] [raw]
Subject: RE: [PATCH 2/3 htlb-fault] Demand faulting for hugetlb

>>-----Original Message-----
>>From: [email protected]
>>[mailto:[email protected]] On Behalf Of Adam Litke
>>Sent: Wednesday, September 07, 2005 5:59 AM
>>To: [email protected]
>>Cc: ADAM G. LITKE [imap]
>>Subject: Re: [PATCH 2/3 htlb-fault] Demand faulting for hugetlb

>>+retry:
>>+ page = find_get_page(mapping, idx);
>>+ if (!page) {
>>+ /* charge the fs quota first */
>>+ if (hugetlb_get_quota(mapping)) {
>>+ ret = VM_FAULT_SIGBUS;
>>+ goto out;
>>+ }
>>+ page = alloc_huge_page();
>>+ if (!page) {
>>+ hugetlb_put_quota(mapping);
>>+ ret = VM_FAULT_SIGBUS;
>>+ goto out;
>>+ }
>>+ if (add_to_page_cache(page, mapping, idx, GFP_ATOMIC)) {

Here you lost hugetlb_put_quota(mapping);


>>+ put_page(page);
>>+ goto retry;
>>+ }
>>+ unlock_page(page);

As for regular pages, kernel is used to unlock mm-> page_table_lock
before find_get_page and relock it before setting pte. Why isn't the
style followed by huge page fault?


2005-09-07 14:04:09

by Adam Litke

[permalink] [raw]
Subject: RE: [PATCH 2/3 htlb-fault] Demand faulting for hugetlb

On Wed, 2005-09-07 at 10:33 +0800, Zhang, Yanmin wrote:
> >>-----Original Message-----
> >>From: [email protected]
> >>[mailto:[email protected]] On Behalf Of Adam Litke
> >>Sent: Wednesday, September 07, 2005 5:59 AM
> >>To: [email protected]
> >>Cc: ADAM G. LITKE [imap]
> >>Subject: Re: [PATCH 2/3 htlb-fault] Demand faulting for hugetlb
>
> >>+retry:
> >>+ page = find_get_page(mapping, idx);
> >>+ if (!page) {
> >>+ /* charge the fs quota first */
> >>+ if (hugetlb_get_quota(mapping)) {
> >>+ ret = VM_FAULT_SIGBUS;
> >>+ goto out;
> >>+ }
> >>+ page = alloc_huge_page();
> >>+ if (!page) {
> >>+ hugetlb_put_quota(mapping);
> >>+ ret = VM_FAULT_SIGBUS;
> >>+ goto out;
> >>+ }
> >>+ if (add_to_page_cache(page, mapping, idx, GFP_ATOMIC)) {
>
> Here you lost hugetlb_put_quota(mapping);

Whoops, thanks for catching that.

> >>+ put_page(page);
> >>+ goto retry;
> >>+ }
> >>+ unlock_page(page);
>
> As for regular pages, kernel is used to unlock mm-> page_table_lock
> before find_get_page and relock it before setting pte. Why isn't the
> style followed by huge page fault?

As far as I can tell, we should be able to do that for large pages as
well. I'll give it a spin.

--
Adam Litke - (agl at us.ibm.com)
IBM Linux Technology Center