Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1291046ybt; Thu, 9 Jul 2020 03:31:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUcFRRzLn3CUH3J6Ct6MkHvMxUTofkpJk1p9zbSA7L63yUB6jP/fZ8dzsbUPBLDmPyxv9V X-Received: by 2002:a17:906:4086:: with SMTP id u6mr59714642ejj.9.1594290686529; Thu, 09 Jul 2020 03:31:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594290686; cv=none; d=google.com; s=arc-20160816; b=n2MdiapxBcc9OWAdBmz1Wt08XogRVdS3pUyA2AnHzAXQEieXMbfXYGHsJP5HoqGS9A DcQHvVoIqxGhwCQL8klrVSKk4RnLQyq7ep1OcGMzkWCQFkaOysFs+tOAwrkK55E/0P0w tPJHl2NYSxdn3N/UUZ6SpuBl9dUUSzAANK24ieI+Gnba9JcV2UVBJ4YiepqWBRSelMPn 5CuH9P5TqT1/rB+d2bXSM803ciuoT4YruTfZOTIOTlMUqb3jzHsKXxoeP74H9Krkergk GMFU4AmZgDC9ISS+h2sMA6D1rrn3q0oyuSJkopa/GGNwE/hy775b1WHPQ8P34Mnvl+l0 l7KA== 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=vhfRd/Xz8WpuPSonhW0aG9Xlw1wwnrJlWi7lZcteXaM=; b=PiuToAfLL+zXt3CJgdXldAG2wrQIr/SIEPNR/ycG+OMsGfDCAJjuseTqevNK21WhFP cz+t/1D6XiPrt4v2nJsV3apv/1u7/J6zK4diR/rWbVlpZ3Xzf5xE39zyt1b2Zwohi80w Pk/WE/PvcB85Wfej28wAyHmWvbiqvtnl/rCnnqHBIuxt0KQEGMiXYVAnijGnegTMTxgk re10xMSH6ZYbA01DQ/neKA9v6TIAfrdqOZof7Tc2Oj8MmFtX2La3zDi9UAfIU4TdKAXx f+UPBJ5IOgoTr9VE+YKFIhrssnWuNle5uGISXVkRWJsnIbqAi2al3olufWy4KQYIitxD oD7w== 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 d10si1533209ejt.515.2020.07.09.03.31.03; Thu, 09 Jul 2020 03:31:26 -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 S1726140AbgGIK2J (ORCPT + 99 others); Thu, 9 Jul 2020 06:28:09 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:41138 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726343AbgGIK2H (ORCPT ); Thu, 9 Jul 2020 06:28:07 -0400 Received: by mail-wr1-f68.google.com with SMTP id z15so1762550wrl.8 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=S75mO0S6CjNG4WwrjeAlmSJcF+KUF5J7bKBqCA4vGOxWErNWhe4zxLp9HKI+3gZqrI cAsuhIWI90VcrG36HKs+dKrTGLK5ppPlD9Nuwo8xw6dLYYVqvnZ+ak/sO5PAFb5Cjl// p6a71sfLjf3a0ZlAv+j0yVVyKO/4kv/292ap9Py4hT4aoj2auEJQHOuPXnDwrG/kNprn w3huaT0xS1Wh1gV+05gSO68bAtPftOR5ta5b+o22G1O4uunjWQzDTppS7Ur0TvMe/hgu mMa3gsPVe1C69GaJuBwF3x1gVa8RU5Bgu14D47DdK3WNVhAIKLiA55udhQpGdKBWVwBW 8YvQ== X-Gm-Message-State: AOAM5315GmJ1i6LglgebluDoKo8Bx/bLYo1kWmFEj5nOVPygCrDJBuQ/ X1toBStAQx/qJu5tj7Dc0tU= 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 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 Thu 09-07-20 16:15:07, Joonsoo Kim wrote: > 2020년 7월 8일 (수) 오전 4:00, Michal Hocko 님이 작성: > > > > 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. First, 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 user 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 __GFP_MOVABLE so > > > it's always GFP_HIGHUSER_MOVABLE. > > Indeed. > > > Right you are! Not that it would make any real difference because only > > 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 about > > soft offlining at this moment). But yeah it would be simply better to > > override gfp mask for hugetlb which we have been doing anyway. > > 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 = 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. -- Michal Hocko SUSE Labs