Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp476116ybt; Wed, 8 Jul 2020 04:35:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMtOXnU9WNGLXrhZd4C335YTFesWxaHUS3Y1GAiV7OFxCSG9svhrn1xs0uTE6WLqLT3ouI X-Received: by 2002:aa7:da89:: with SMTP id q9mr67518837eds.273.1594208147261; Wed, 08 Jul 2020 04:35:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594208147; cv=none; d=google.com; s=arc-20160816; b=Y/w8/5m4jXSePlvSKyxYMRLyd6opldO+EeiJtTMdVqkk9BIHysD7nEM2/O26hZL3dE euaEstzcJRIcIzm4jxlKsBKRWVpoFdfBTa0xIgWHNzQxPfrDaALTPPeGUvtxVM+STlqI qMOxfw65Ewlc3vjUpuuCvJeo2AYrOeZhlYlrWZ7tQXywUkD3kGWHPmxzYuFyheTUlctd HNWmw+Ts+TBOnqa9L6WUTKVD+G1wvUY5xZGfsFGOsgDrl1UP2183QWSjvjUllDk/eMku K0mD2X/I6WR75K+0oQZA54Slu4JHVtg06RR1F5Vfx2BpvvWmSIZ/j2iXWtprLH9aSN3V FN3Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=+9BlsY0XFg5CpKVe1acIU9xV2I7eOlxFrwWt4OM7Tc0=; b=iT/8AHMZX69jn2+xDcZl8XKQ2D0HKor6yH+HoXEq5j/mGYcIECWCWeOByoTpzH4QFi mGLt/P1DYiVeLN+xE8Up6Ywhgz6MnBxZrMDxS9m1qed00h3nftMcFXZz5sbPjeJubLOc uyOl17z1gba9zwaogp7xs1waptOQQf2X14DVUcOXf5wgeUq56ewGci+cavZ6bv5Tfx++ p1PKrbC413T5RbrxhJaYNobOQYWFnGGpJIAug4oyIGyaxDZFEJ22Gd8VQ9eSI6VEXt6M z9NrT3S5xtxq/MkJpi8MjX0dwZ3xBYlldQNy0Tj3//OW79CrZVoVLCWbEYOmD2ZaLgkB fSvg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p26si17154894edy.181.2020.07.08.04.35.24; Wed, 08 Jul 2020 04:35:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728908AbgGHLdA (ORCPT + 99 others); Wed, 8 Jul 2020 07:33:00 -0400 Received: from mail-ej1-f65.google.com ([209.85.218.65]:35773 "EHLO mail-ej1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728897AbgGHLc7 (ORCPT ); Wed, 8 Jul 2020 07:32:59 -0400 Received: by mail-ej1-f65.google.com with SMTP id rk21so50050987ejb.2 for ; Wed, 08 Jul 2020 04:32:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=+9BlsY0XFg5CpKVe1acIU9xV2I7eOlxFrwWt4OM7Tc0=; b=NsZBP1J4gJKl82kqc9uimQF6MYcAQd0Nw4rSTX9DVXZUigT8Chi61cBVFBBtMv6YiD J8+xsVDRmrb2Vvr5Mnl01BfUA0ibEuAgPkhmhj1hwW5Mo6SEiq6rxUaIVP0XxH5YBoeR 4bXnyb+aIHDdQ2j+wRPYfom87YST0BqhefChxB9KcEdCMDZfOy2diRM95AUlCpHp0Tul GRuHeebdhZuem9JbLf0+3dT2L15z4V/RnvY0DIN5vueSylF7IPrk/5ba9EVUu+VdEYla SIh1wiSR8bMC8BANShunx0RHEf4RC678Xl3qxNPHQ8TcSi4GyMBpFD2dyHzKms+shJj9 8M3w== X-Gm-Message-State: AOAM531xy4bVw1KK4T+i+9ej6zs3wYQaUVoWrvKDvUBFBwsAzQiPaiXI 142UWfHn5SW/BQoqx7mRWJc= X-Received: by 2002:a17:906:2a5b:: with SMTP id k27mr49749551eje.82.1594207977416; Wed, 08 Jul 2020 04:32:57 -0700 (PDT) Received: from localhost (ip-37-188-179-51.eurotel.cz. [37.188.179.51]) by smtp.gmail.com with ESMTPSA id cz2sm26895698edb.82.2020.07.08.04.32.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 04:32:56 -0700 (PDT) Date: Wed, 8 Jul 2020 13:32:54 +0200 From: Michal Hocko To: "Aneesh Kumar K.V" Cc: Vlastimil Babka , Joonsoo Kim , Andrew Morton , linux-mm@kvack.org, linux-kernel@vger.kernel.org, kernel-team@lge.com, Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , "Aneesh Kumar K.V" Subject: Re: [PATCH v4 04/11] mm/hugetlb: make hugetlb migration callback CMA aware Message-ID: <20200708113254.GI7271@dhcp22.suse.cz> References: <1594107889-32228-1-git-send-email-iamjoonsoo.kim@lge.com> <1594107889-32228-5-git-send-email-iamjoonsoo.kim@lge.com> <20200708071602.GB16543@js1304-desktop> <20200708074103.GD7271@dhcp22.suse.cz> <8549326e-7485-dd6d-1fa1-a899228b9b2f@suse.cz> <87h7uil1f7.fsf@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87h7uil1f7.fsf@linux.ibm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 08-07-20 16:27:16, Aneesh Kumar K.V wrote: > Vlastimil Babka writes: > > > On 7/8/20 9:41 AM, Michal Hocko wrote: > >> On Wed 08-07-20 16:16:02, Joonsoo Kim wrote: > >>> On Tue, Jul 07, 2020 at 01:22:31PM +0200, Vlastimil Babka wrote: > >>> > >>> Simply, I call memalloc_nocma_{save,restore} in new_non_cma_page(). It > >>> would not cause any problem. > >> > >> I believe a proper fix is the following. The scope is really defined for > >> FOLL_LONGTERM pins and pushing it inside check_and_migrate_cma_pages > >> will solve the problem as well but it imho makes more sense to do it in > >> the caller the same way we do for any others. > >> > >> Fixes: 9a4e9f3b2d73 ("mm: update get_user_pages_longterm to migrate pages allocated from CMA region") > > > > Agreed. > > > >> > >> I am not sure this is worth backporting to stable yet. > > > > CC Aneesh. > > > > Context: since check_and_migrate_cma_pages() calls __get_user_pages_locked(), it > > should also be called under memalloc_nocma_save(). > > But by then we faulted in all relevant pages and migrated them out of > CMA rea right? check_and_migrate_cma_pages will allocate target pages that you want to migrate off the CMA region unless I am misreading the code. And those allocation need to be placed outside of the CMA. -- Michal Hocko SUSE Labs