Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1171992 > unrolled thread

Re: [RFC PATCH 10/12] mm: add the buddy system interface

Started byXishi Qiu <qiuxishi@huawei.com>
First post2015-06-25 11:50 +0200
Last post2015-06-26 04:00 +0200
Articles 2 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [RFC PATCH 10/12] mm: add the buddy system interface Xishi Qiu <qiuxishi@huawei.com> - 2015-06-25 11:50 +0200
    Re: [RFC PATCH 10/12] mm: add the buddy system interface Xishi Qiu <qiuxishi@huawei.com> - 2015-06-26 04:00 +0200

#1171992 — Re: [RFC PATCH 10/12] mm: add the buddy system interface

FromXishi Qiu <qiuxishi@huawei.com>
Date2015-06-25 11:50 +0200
SubjectRe: [RFC PATCH 10/12] mm: add the buddy system interface
Message-ID<pFbXe-4YO-41@gated-at.bofh.it>
On 2015/6/10 11:06, Kamezawa Hiroyuki wrote:

> On 2015/06/09 19:04, Xishi Qiu wrote:
>> On 2015/6/9 15:12, Kamezawa Hiroyuki wrote:
>>
>>> On 2015/06/04 22:04, Xishi Qiu wrote:
>>>> Add the buddy system interface for address range mirroring feature.
>>>> Allocate mirrored pages in MIGRATE_MIRROR list. If there is no mirrored pages
>>>> left, use other types pages.
>>>>
>>>> Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
>>>> ---
>>>>    mm/page_alloc.c | 40 +++++++++++++++++++++++++++++++++++++++-
>>>>    1 file changed, 39 insertions(+), 1 deletion(-)
>>>>
>>>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>>>> index d4d2066..0fb55288 100644
>>>> --- a/mm/page_alloc.c
>>>> +++ b/mm/page_alloc.c
>>>> @@ -599,6 +599,26 @@ static inline bool is_mirror_pfn(unsigned long pfn)
>>>>
>>>>        return false;
>>>>    }
>>>> +
>>>> +static inline bool change_to_mirror(gfp_t gfp_flags, int high_zoneidx)
>>>> +{
>>>> +    /*
>>>> +     * Do not alloc mirrored memory below 4G, because 0-4G is
>>>> +     * all mirrored by default, and the list is always empty.
>>>> +     */
>>>> +    if (high_zoneidx < ZONE_NORMAL)
>>>> +        return false;
>>>> +
>>>> +    /* Alloc mirrored memory for only kernel */
>>>> +    if (gfp_flags & __GFP_MIRROR)
>>>> +        return true;
>>>
>>> GFP_KERNEL itself should imply mirror, I think.
>>>
>>
>> Hi Kame,
>>
>> How about like this: #define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_MIRROR) ?
>>
> 
> Hm.... it cannot cover GFP_ATOMIC at el.
> 
> I guess, mirrored memory should be allocated if !__GFP_HIGHMEM or !__GFP_MOVABLE


Hi Kame,

Can we distinguish allocations form user or kernel only by GFP flags?

Thanks,
Xishi Qiu

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

[toc] | [next] | [standalone]


#1172547

FromXishi Qiu <qiuxishi@huawei.com>
Date2015-06-26 04:00 +0200
Message-ID<pFr5U-1h6-1@gated-at.bofh.it>
In reply to#1171992
On 2015/6/26 7:54, Kamezawa Hiroyuki wrote:

> On 2015/06/25 18:44, Xishi Qiu wrote:
>> On 2015/6/10 11:06, Kamezawa Hiroyuki wrote:
>>
>>> On 2015/06/09 19:04, Xishi Qiu wrote:
>>>> On 2015/6/9 15:12, Kamezawa Hiroyuki wrote:
>>>>
>>>>> On 2015/06/04 22:04, Xishi Qiu wrote:
>>>>>> Add the buddy system interface for address range mirroring feature.
>>>>>> Allocate mirrored pages in MIGRATE_MIRROR list. If there is no mirrored pages
>>>>>> left, use other types pages.
>>>>>>
>>>>>> Signed-off-by: Xishi Qiu <qiuxishi@huawei.com>
>>>>>> ---
>>>>>>     mm/page_alloc.c | 40 +++++++++++++++++++++++++++++++++++++++-
>>>>>>     1 file changed, 39 insertions(+), 1 deletion(-)
>>>>>>
>>>>>> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
>>>>>> index d4d2066..0fb55288 100644
>>>>>> --- a/mm/page_alloc.c
>>>>>> +++ b/mm/page_alloc.c
>>>>>> @@ -599,6 +599,26 @@ static inline bool is_mirror_pfn(unsigned long pfn)
>>>>>>
>>>>>>         return false;
>>>>>>     }
>>>>>> +
>>>>>> +static inline bool change_to_mirror(gfp_t gfp_flags, int high_zoneidx)
>>>>>> +{
>>>>>> +    /*
>>>>>> +     * Do not alloc mirrored memory below 4G, because 0-4G is
>>>>>> +     * all mirrored by default, and the list is always empty.
>>>>>> +     */
>>>>>> +    if (high_zoneidx < ZONE_NORMAL)
>>>>>> +        return false;
>>>>>> +
>>>>>> +    /* Alloc mirrored memory for only kernel */
>>>>>> +    if (gfp_flags & __GFP_MIRROR)
>>>>>> +        return true;
>>>>>
>>>>> GFP_KERNEL itself should imply mirror, I think.
>>>>>
>>>>
>>>> Hi Kame,
>>>>
>>>> How about like this: #define GFP_KERNEL (__GFP_WAIT | __GFP_IO | __GFP_FS | __GFP_MIRROR) ?
>>>>
>>>
>>> Hm.... it cannot cover GFP_ATOMIC at el.
>>>
>>> I guess, mirrored memory should be allocated if !__GFP_HIGHMEM or !__GFP_MOVABLE
>>
>>
>> Hi Kame,
>>
>> Can we distinguish allocations form user or kernel only by GFP flags?
>>
> 
> Allocation from user and file caches are now *always* done with __GFP_MOVABLE.
> 
> By this, pages will be allocated from MIGRATE_MOVABLE migration type.
> MOVABLE migration type means it's can
> be the target for page compaction or memory-hot-remove.
> 
> Thanks,
> -Kame
> 

So if we want all kernel memory allocated from mirror, how about change like this?
__alloc_pages_nodemask()
  gfpflags_to_migratetype()
    if (!(gfp_mask & __GFP_MOVABLE))
	return MIGRATE_MIRROR

Thanks,
Xishi Qiu

> 
> 
> 
> 
> 
> 
> 
> .
> 



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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web