From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.0 required=3.0 tests=MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0C265C433DF for ; Thu, 9 Jul 2020 10:28:08 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D0365206DF for ; Thu, 9 Jul 2020 10:28:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D0365206DF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 594F36B0006; Thu, 9 Jul 2020 06:28:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5466B6B0007; Thu, 9 Jul 2020 06:28:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 45ACB6B0008; Thu, 9 Jul 2020 06:28:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id 2F22D6B0006 for ; Thu, 9 Jul 2020 06:28:07 -0400 (EDT) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id BD21782499A8 for ; Thu, 9 Jul 2020 10:28:06 +0000 (UTC) X-FDA: 77018162172.15.worm73_0f122f526ec5 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id 871921814B0CA for ; Thu, 9 Jul 2020 10:28:06 +0000 (UTC) X-HE-Tag: worm73_0f122f526ec5 X-Filterd-Recvd-Size: 5161 Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by imf01.hostedemail.com (Postfix) with ESMTP for ; Thu, 9 Jul 2020 10:28:06 +0000 (UTC) Received: by mail-wr1-f66.google.com with SMTP id b6so1749795wrs.11 for ; Thu, 09 Jul 2020 03:28:05 -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=vhfRd/Xz8WpuPSonhW0aG9Xlw1wwnrJlWi7lZcteXaM=; b=Vv1wJ2/m2Y/Ik6zpRw2ObSVQukJgNzCgchRb8c+Z/yhgvFnEKJOzdddbOX1kTmN6x5 lIElPS8fgQBeXMyzDIu/42IqAOv8Uv9NRw63zFzKg6MTY/ZG68/47OYEhJbzwjyXZrwU Kk6zIvOSYfUsJl1qf1LccVRi/X3sj7BFlPcO/un2sGR8d+rHUZVNjWSlxqiu9BTXNKC1 OujXFOoy/si17XCCxqMKHD4D0mgTtPzBW5ajTMnbENXSiHk1QyGxQxN70ObeXxbKtJG/ p5eBRoLkq4ffYMSZZdEToHC1NKXDMB7lXfnoiJn9h2H6C6S3gPf/C80G4fMnptTnYbSv giZg== X-Gm-Message-State: AOAM5311jAmMq41LGOIIIxrCN5ERFJRO4dloLUVEAzjT6Uf+ClKOBmfZ Hcuth69+blkHx3fDAYanwOc= X-Google-Smtp-Source: ABdhPJxcmx3Lx6wndlpfqk3KIOiLTmInXeRHGpBBRxv1uHl97R8fkaA7/H4YSMEhkpYj1mv9iEtkVQ== X-Received: by 2002:adf:f546:: with SMTP id j6mr61821883wrp.167.1594290484936; Thu, 09 Jul 2020 03:28:04 -0700 (PDT) Received: from localhost (ip-37-188-179-51.eurotel.cz. [37.188.179.51]) by smtp.gmail.com with ESMTPSA id o21sm4026136wmh.18.2020.07.09.03.28.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 09 Jul 2020 03:28:04 -0700 (PDT) Date: Thu, 9 Jul 2020 12:28:03 +0200 From: Michal Hocko To: Joonsoo Kim Cc: Vlastimil Babka , Andrew Morton , Linux Memory Management List , LKML , kernel-team@lge.com, Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Joonsoo Kim Subject: Re: [PATCH v4 06/11] mm/migrate: make a standard migration target allocation function Message-ID: <20200709102803.GF19160@dhcp22.suse.cz> References: <1594107889-32228-1-git-send-email-iamjoonsoo.kim@lge.com> <1594107889-32228-7-git-send-email-iamjoonsoo.kim@lge.com> <409b6e24-d143-a61c-95a3-1a55e1a6008e@suse.cz> <20200707190013.GZ5913@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 871921814B0CA X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 Content-Transfer-Encoding: quoted-printable X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 09-07-20 16:15:07, Joonsoo Kim wrote: > 2020=EB=85=84 7=EC=9B=94 8=EC=9D=BC (=EC=88=98) =EC=98=A4=EC=A0=84 4:00= , Michal Hocko =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > > > On Tue 07-07-20 16:49:51, Vlastimil Babka wrote: > > > On 7/7/20 9:44 AM, js1304@gmail.com wrote: > > > > From: Joonsoo Kim > > > > > > > > There are some similar functions for migration target allocation.= Since > > > > there is no fundamental difference, it's better to keep just one = rather > > > > than keeping all variants. This patch implements base migration = target > > > > allocation function. In the following patches, variants will be = converted > > > > to use this function. > > > > > > > > Changes should be mechanical but there are some differences. Firs= t, Some > > > > callers' nodemask is assgined to NULL since NULL nodemask will be > > > > considered as all available nodes, that is, &node_states[N_MEMORY= ]. > > > > Second, for hugetlb page allocation, gfp_mask is ORed since a use= r could > > > > provide a gfp_mask from now on. > > > > > > I think that's wrong. See how htlb_alloc_mask() determines between > > > GFP_HIGHUSER_MOVABLE and GFP_HIGHUSER, but then you OR it with __GF= P_MOVABLE so > > > it's always GFP_HIGHUSER_MOVABLE. >=20 > Indeed. >=20 > > Right you are! Not that it would make any real difference because onl= y > > migrateable hugetlb pages will get __GFP_MOVABLE and so we shouldn't > > really end up here for !movable pages in the first place (not sure ab= out > > soft offlining at this moment). But yeah it would be simply better to > > override gfp mask for hugetlb which we have been doing anyway. >=20 > Override gfp mask doesn't work since some users will call this function= with > __GFP_THISNODE. > I will use hugepage_movable_supported() here and > clear __GFP_MOVABLE if needed. hugepage_movable_supported is really an implementation detail, do not use it here. I think it would be better to add gfp_t htlb_modify_alloc_mask(struct hstate *h, gfp_t mask) { gfp_t default_mask =3D htlb_alloc_mask(h); /* Some callers might want to enforce node */ return default_mask | (mask & __GFP_THISNODE); } If we need to special case others, eg reclaim restrictions there would be a single place to do so. --=20 Michal Hocko SUSE Labs