Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753313AbdLUXfi (ORCPT ); Thu, 21 Dec 2017 18:35:38 -0500 Received: from aserp2120.oracle.com ([141.146.126.78]:49990 "EHLO aserp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751572AbdLUXfh (ORCPT ); Thu, 21 Dec 2017 18:35:37 -0500 Subject: Re: [RFC PATCH 0/5] mm, hugetlb: allocation API and migration improvements To: Michal Hocko Cc: Naoya Horiguchi , "linux-mm@kvack.org" , Andrew Morton , LKML References: <20171204140117.7191-1-mhocko@kernel.org> <20171215093309.GU16951@dhcp22.suse.cz> <95ba8db3-f8aa-528a-db4b-80f9d2ba9d2b@ah.jp.nec.com> <20171220095328.GG4831@dhcp22.suse.cz> <233096d8-ecbc-353a-023a-4f6fa72ebb2f@oracle.com> <20171221072802.GY4831@dhcp22.suse.cz> From: Mike Kravetz Message-ID: <659e21c7-ebed-8b64-053a-f01a31ef6e25@oracle.com> Date: Thu, 21 Dec 2017 15:35:28 -0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <20171221072802.GY4831@dhcp22.suse.cz> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=5900 definitions=8752 signatures=668651 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 malwarescore=0 phishscore=0 bulkscore=0 spamscore=0 mlxscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1711220000 definitions=main-1712210310 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1964 Lines: 43 On 12/20/2017 11:28 PM, Michal Hocko wrote: > On Wed 20-12-17 14:43:03, Mike Kravetz wrote: >> On 12/20/2017 01:53 AM, Michal Hocko wrote: >>> On Wed 20-12-17 05:33:36, Naoya Horiguchi wrote: >>>> I have one comment on the code path from mbind(2). >>>> The callback passed to migrate_pages() in do_mbind() (i.e. new_page()) >>>> calls alloc_huge_page_noerr() which currently doesn't call SetPageHugeTemporary(), >>>> so hugetlb migration fails when h->surplus_huge_page >= h->nr_overcommit_huge_pages. >>> >>> Yes, I am aware of that. I should have been more explicit in the >>> changelog. Sorry about that and thanks for pointing it out explicitly. >>> To be honest I wasn't really sure what to do about this. The code path >>> is really complex and it made my head spin. I fail to see why we have to >>> call alloc_huge_page and mess with reservations at all. >> >> Oops! I missed that in my review. >> >> Since alloc_huge_page was called with avoid_reserve == 1, it should not >> do anything with reserve counts. One potential issue with the existing >> code is cgroup accounting done by alloc_huge_page. When the new target >> page is allocated, it is charged against the cgroup even though the original >> page is still accounted for. If we are 'at the cgroup limit', the migration >> may fail because of this. > > Yeah, the existing code seems just broken. I strongly suspect that the > allocation API for hugetlb was so complicated that this was just a > natural result of a confusion with some follow up changes on top. > >> I like your new code below as it explicitly takes reserve and cgroup >> accounting out of the picture for migration. Let me think about it >> for another day before providing a Reviewed-by. > > Thanks a lot! You can add, Reviewed-by: Mike Kravetz I had some concerns about transferring huge page state during migration not specific to this patch, so I did a bunch of testing. -- Mike Kravetz