Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp3046281ybt; Mon, 29 Jun 2020 13:50:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbTpmRbxOsbqJotn+lhEra13Q4TuXJInkxLlUsRYDvcRzKE2loLINZk3tJpQloyVvocGT6 X-Received: by 2002:a17:906:fa15:: with SMTP id lo21mr16294358ejb.156.1593463846311; Mon, 29 Jun 2020 13:50:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593463846; cv=none; d=google.com; s=arc-20160816; b=RUtlGC4tC2GKR/ee9yoaNVC79ZxTdhl1URO9B3evQmB+4/F1FVgGHIPk/1Euu0118d 2fMYrPjxETxhuJk8tOxLNDZ4c0mX5ejQErUFO3oRUHmL0BiSv4YkkRDBHrrnufE8W6Kk we1rhej1K/s2qwBhcYhS2SwbZyAEBXFcl+rq0x4qWd5uWG/lnFRwiDcaOIR+hIGbJoxc Qe35Mz120HNKPHrERw4VNndnJ9UxHL4EiphM5Z7LbO1HkLl1h8hkxBHU4evfXGnM7eSz MCESaspTgc/mtruf8YAru1H3v0FRSa2V0aMgrJFD2/RRVMCgu53OKL+3s0pdtNDL2ZZ+ ThxA== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=tU/p6/XQD1UtMhsPATQwXv6wMmo7z9qcgbgQtemfgDk=; b=C/IdI2YdGTKV0MX5qaOlDXeurmF0x+nAKLBlEBBG9L5LZ2Q5c6Np6R987WrKbjdP6q vAGK57ONIPtvrqaZLWDPbNzKfb9kW81PQQs+aeD6qDDLg2sC/P9vSXCtXv7TEWzDjzcL GSsp9E2mkrH2naSZetjA6qJz/Xz2IoJh6n5JBXkahAAbACnO4ERA4pRW7WgUKIrQE3Kf nxc1mexwDPkCnW14bewvxMbt/tMRHH3AlCFwCCJb8FRi6/on5TZ39Vw7EXPF8723Xz/i 3cJ0XOMtv261585JMGO/IKTmNAJlhNPMVhVj5M4UKguY2t86TPlVMJL542/v7GIAndA0 4ykg== 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 b12si201551eds.283.2020.06.29.13.50.23; Mon, 29 Jun 2020 13:50:46 -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 S2389491AbgF2UrZ (ORCPT + 99 others); Mon, 29 Jun 2020 16:47:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731532AbgF2TNw (ORCPT ); Mon, 29 Jun 2020 15:13:52 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E292C014AFD for ; Mon, 29 Jun 2020 01:03:53 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id by13so2153500edb.11 for ; Mon, 29 Jun 2020 01:03:53 -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:content-transfer-encoding :in-reply-to; bh=tU/p6/XQD1UtMhsPATQwXv6wMmo7z9qcgbgQtemfgDk=; b=PgAlD3Agd6yrN87LXFvAIhwHZzgLemW5Lyos8HKYyo3w6lbPwBXp+ZxstLHbk7e8Ou 7Lqy5I7/Z7uJnnkB78xqVCWzbycH0Hn03Gio9iETOiWIbJ/EWfJtqVNVgrx9muvH6TKU cCw9lP1xx+5orVSuCvLonCKJGfhRQKiiQ5LpRX+IN4icw2cwhtnP7+iQO2rvXlwMGYWN h8O73y2dMPoLCa28rrkiCw+RhJv8JANP/nXr6YYeR4npeEabJd5/MyX0fqhQtC0vmxz+ gNw7CV8HvMtlrmG7MeUiykiZqLrRwszoQesV6fi3Qaw4yjT2EZH4CMjGvkVk924zTe43 uuwA== X-Gm-Message-State: AOAM531c9QD+dHhR5H5nQtti9RSO8iS2+H414zIlxOFHujPld1UpFH5X zt+kqG3hUpVGfEiDNOWKazM= X-Received: by 2002:aa7:c98d:: with SMTP id c13mr8016803edt.188.1593417831943; Mon, 29 Jun 2020 01:03:51 -0700 (PDT) Received: from localhost (ip-37-188-168-3.eurotel.cz. [37.188.168.3]) by smtp.gmail.com with ESMTPSA id y21sm23452236ejp.32.2020.06.29.01.03.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Jun 2020 01:03:51 -0700 (PDT) Date: Mon, 29 Jun 2020 10:03:50 +0200 From: Michal Hocko To: Joonsoo Kim Cc: Andrew Morton , Linux Memory Management List , LKML , kernel-team@lge.com, Vlastimil Babka , Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Joonsoo Kim Subject: Re: [PATCH v3 5/8] mm/migrate: make a standard migration target allocation function Message-ID: <20200629080350.GB32461@dhcp22.suse.cz> References: <1592892828-1934-1-git-send-email-iamjoonsoo.kim@lge.com> <1592892828-1934-6-git-send-email-iamjoonsoo.kim@lge.com> <20200625120550.GF1320@dhcp22.suse.cz> <20200626073342.GU1320@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 29-06-20 15:41:37, Joonsoo Kim wrote: > 2020년 6월 26일 (금) 오후 4:33, Michal Hocko 님이 작성: > > > > On Fri 26-06-20 14:02:49, Joonsoo Kim wrote: > > > 2020년 6월 25일 (목) 오후 9:05, Michal Hocko 님이 작성: > > > > > > > > On Tue 23-06-20 15:13:45, Joonsoo Kim wrote: > > [...] > > > > > -struct page *new_page_nodemask(struct page *page, > > > > > - int preferred_nid, nodemask_t *nodemask) > > > > > +struct page *alloc_migration_target(struct page *page, unsigned long private) > > > > > { > > > > > - gfp_t gfp_mask = GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL; > > > > > + struct migration_target_control *mtc; > > > > > + gfp_t gfp_mask; > > > > > unsigned int order = 0; > > > > > struct page *new_page = NULL; > > > > > + int zidx; > > > > > + > > > > > + mtc = (struct migration_target_control *)private; > > > > > + gfp_mask = mtc->gfp_mask; > > > > > > > > > > if (PageHuge(page)) { > > > > > return alloc_huge_page_nodemask( > > > > > - page_hstate(compound_head(page)), > > > > > - preferred_nid, nodemask, 0, false); > > > > > + page_hstate(compound_head(page)), mtc->nid, > > > > > + mtc->nmask, gfp_mask, false); > > > > > } > > > > > > > > > > if (PageTransHuge(page)) { > > > > > + gfp_mask &= ~__GFP_RECLAIM; > > > > > > > > What's up with this gfp_mask modification? > > > > > > THP page allocation uses a standard gfp masks, GFP_TRANSHUGE_LIGHT and > > > GFP_TRANHUGE. __GFP_RECLAIM flags is a big part of this standard mask design. > > > So, I clear it here so as not to disrupt the THP gfp mask. > > > > Why this wasn't really needed before? I guess I must be missing > > something here. This patch should be mostly mechanical convergence of > > existing migration callbacks but this change adds a new behavior AFAICS. > > Before this patch, a user cannot specify a gfp_mask and THP allocation > uses GFP_TRANSHUGE > statically. Unless I am misreading there are code paths (e.g.new_page_nodemask) which simply use add GFP_TRANSHUGE to GFP_USER | __GFP_MOVABLE | __GFP_RETRY_MAYFAIL. And this goes all the way to thp migration introduction. > After this patch, a user can specify a gfp_mask and it > could conflict with GFP_TRANSHUGE. > This code tries to avoid this conflict. > > > It would effectively drop __GFP_RETRY_MAYFAIL and __GFP_KSWAPD_RECLAIM > > __GFP_RETRY_MAYFAIL isn't dropped. __GFP_RECLAIM is > "___GFP_DIRECT_RECLAIM|___GFP_KSWAPD_RECLAIM". > So, __GFP_KSWAPD_RECLAIM would be dropped for THP allocation. > IIUC, THP allocation doesn't use __GFP_KSWAPD_RECLAIM since it's > overhead is too large and this overhead should be given to the caller > rather than system thread (kswapd) and so on. Yes, there is a reason why KSWAPD is excluded from THP allocations in the page fault path. Maybe we want to extend that behavior to the migration as well. I do not have a strong opinion on that because I haven't seen excessive kswapd reclaim due to THP migrations. They are likely too rare. But as I've said in my previous email. Make this a separate patch with an explanation why we want this. -- Michal Hocko SUSE Labs