All of lore.kernel.org
 help / color / mirror / Atom feed
From: Huang Shijie <b32955@freescale.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: introduce __linear_page_index()
Date: Sun, 17 Feb 2013 15:39:41 +0800	[thread overview]
Message-ID: <5120893D.6090705@freescale.com> (raw)
In-Reply-To: <20130205132741.1e1a4e04.akpm@linux-foundation.org>

于 2013年02月06日 05:27, Andrew Morton 写道:
> On Tue, 5 Feb 2013 15:03:39 +0800
> Huang Shijie<b32955@freescale.com>  wrote:
>
>> +static inline pgoff_t __linear_page_index(struct vm_area_struct *vma,
>>   					unsigned long address)
>>   {
>>   	pgoff_t pgoff;
>> +
>> +	pgoff = (address - vma->vm_start)>>  PAGE_SHIFT;
>> +	return pgoff + vma->vm_pgoff;
>> +}
>> +
>> +static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
>> +					unsigned long address)
>> +{
>>   	if (unlikely(is_vm_hugetlb_page(vma)))
>>   		return linear_hugepage_index(vma, address);
>> -	pgoff = (address - vma->vm_start)>>  PAGE_SHIFT;
>> -	pgoff += vma->vm_pgoff;
>> -	return pgoff>>  (PAGE_CACHE_SHIFT - PAGE_SHIFT);
>> +	return __linear_page_index(vma, address)>>
>> +				(PAGE_CACHE_SHIFT - PAGE_SHIFT);
>>   }
> I don't think we need bother creating both linear_page_index() and
> __linear_page_index().  Realistically, we won't be supporting
Just as Hocko said, the unmap_ref_private() (in hugetlb.c) may also uses 
the __linear_page_index().
So it's better to the two helpers : linear_page_index() and 
__linear_page_index().
do you agree?

thanks
Huang Shijie

--
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>

WARNING: multiple messages have this Message-ID (diff)
From: Huang Shijie <b32955@freescale.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: <linux-mm@kvack.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: introduce __linear_page_index()
Date: Sun, 17 Feb 2013 15:39:41 +0800	[thread overview]
Message-ID: <5120893D.6090705@freescale.com> (raw)
In-Reply-To: <20130205132741.1e1a4e04.akpm@linux-foundation.org>

于 2013年02月06日 05:27, Andrew Morton 写道:
> On Tue, 5 Feb 2013 15:03:39 +0800
> Huang Shijie<b32955@freescale.com>  wrote:
>
>> +static inline pgoff_t __linear_page_index(struct vm_area_struct *vma,
>>   					unsigned long address)
>>   {
>>   	pgoff_t pgoff;
>> +
>> +	pgoff = (address - vma->vm_start)>>  PAGE_SHIFT;
>> +	return pgoff + vma->vm_pgoff;
>> +}
>> +
>> +static inline pgoff_t linear_page_index(struct vm_area_struct *vma,
>> +					unsigned long address)
>> +{
>>   	if (unlikely(is_vm_hugetlb_page(vma)))
>>   		return linear_hugepage_index(vma, address);
>> -	pgoff = (address - vma->vm_start)>>  PAGE_SHIFT;
>> -	pgoff += vma->vm_pgoff;
>> -	return pgoff>>  (PAGE_CACHE_SHIFT - PAGE_SHIFT);
>> +	return __linear_page_index(vma, address)>>
>> +				(PAGE_CACHE_SHIFT - PAGE_SHIFT);
>>   }
> I don't think we need bother creating both linear_page_index() and
> __linear_page_index().  Realistically, we won't be supporting
Just as Hocko said, the unmap_ref_private() (in hugetlb.c) may also uses 
the __linear_page_index().
So it's better to the two helpers : linear_page_index() and 
__linear_page_index().
do you agree?

thanks
Huang Shijie


  parent reply	other threads:[~2013-02-17  7:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05  7:03 [PATCH] mm: introduce __linear_page_index() Huang Shijie
2013-02-05  7:03 ` Huang Shijie
2013-02-05 21:27 ` Andrew Morton
2013-02-05 21:27   ` Andrew Morton
2013-02-15 15:02   ` Michal Hocko
2013-02-15 15:02     ` Michal Hocko
2013-02-17  7:39   ` Huang Shijie [this message]
2013-02-17  7:39     ` Huang Shijie

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=5120893D.6090705@freescale.com \
    --to=b32955@freescale.com \
    --cc=akpm@linux-foundation.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.