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=-3.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,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 1757BC433DF for ; Thu, 9 Jul 2020 03:25:40 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id C9AF0206F6 for ; Thu, 9 Jul 2020 03:25:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="eJkV7KBx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C9AF0206F6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 484546B0003; Wed, 8 Jul 2020 23:25:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 436BB6B0005; Wed, 8 Jul 2020 23:25:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 325EE6B0006; Wed, 8 Jul 2020 23:25:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0145.hostedemail.com [216.40.44.145]) by kanga.kvack.org (Postfix) with ESMTP id 1E4A06B0003 for ; Wed, 8 Jul 2020 23:25:39 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id CB68D180AD811 for ; Thu, 9 Jul 2020 03:25:38 +0000 (UTC) X-FDA: 77017097556.18.sand87_1c0366e26ec2 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 8FF61100EDBFA for ; Thu, 9 Jul 2020 03:25:38 +0000 (UTC) X-HE-Tag: sand87_1c0366e26ec2 X-Filterd-Recvd-Size: 5646 Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) by imf35.hostedemail.com (Postfix) with ESMTP for ; Thu, 9 Jul 2020 03:25:38 +0000 (UTC) Received: by mail-qt1-f193.google.com with SMTP id g13so670283qtv.8 for ; Wed, 08 Jul 2020 20:25:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=LOg+f3qhnwQmEv3CzFJxkl1rctpcpyUrfk9aMulJx7M=; b=eJkV7KBxSafkL4HURo1waDCP/9DJQrH839C7BP4d2pLoVRHmry9RD58EEWmKz0pM9W 1LR3yhI0QgjCKEX1PFZoeadc4pi1GYakfUUsbd0nuEi1Sx6MR/iGxGN56BTm3mf6A9pf 7DBnfpP24Bmllz2R4Ok0BFE03J32LJqFIL2AFlDuc7U3z+nKacRrUz+B4DUp4uvXq3zF +XX6Fex3GkoH18kpM7AYIf/2fET1Zc2qUmFOoCw3L76Auy7OmVCP7QaG4JqW/m+Umfme eLE7nWgEa51HjKovrEDrFAt+/35l4PO0UuWs1/S4aB6swtbR+z5RFpcGk3wgfc+KpZTc nh5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=LOg+f3qhnwQmEv3CzFJxkl1rctpcpyUrfk9aMulJx7M=; b=hB0jNlw/C7fm4G2+o4fDC/T0Wrxnq/EI1iVWP98O1e4O8yxh2eMrYJ4Yf7UiqeBBbl mgfWK8UtkjGphI93xIPa6KG1FlWvgKIWLl8pPB6ykE+8jLcqWgq0tEdEWGzU7NS24wRS 8F3ICrt2hWiQhcof4XRzZNI33iV0EG2l9wxcBvSTaQBNcZKmR693FFCyEvJkXBC87Qq5 cEnuTWnGRjhdqufQCQzu7gL0dUjbRLRZtMcdypSIaJ5FlQ1EU4uCJf/xVCkoDju8OpeY lQR8zM412JrmOkE/xKQ7592Jb1jOB+Oz1Kcqfs5IcvmxkaMqGVrjRCUSdRUFKGdiKUJ3 dsug== X-Gm-Message-State: AOAM531bCZvdIZ4gryUGzJrXBlSNNfAVkuHwi8iSXg0P9vZ2QHXMIkwX 2vocsbT7PEC2AiVpLdAizrzCY73leb8UWI2K7ns= X-Google-Smtp-Source: ABdhPJw0Q/Ut7/2bkhotkhqZH5Tfr8SZaQDdE5Ab0dJiE1MatYpXZU5MfcgVESlhklquY7ydZpnJyOi2DHregWhNTbg= X-Received: by 2002:aed:22ef:: with SMTP id q44mr60197673qtc.333.1594265137456; Wed, 08 Jul 2020 20:25:37 -0700 (PDT) MIME-Version: 1.0 References: <1594107889-32228-1-git-send-email-iamjoonsoo.kim@lge.com> <1594107889-32228-12-git-send-email-iamjoonsoo.kim@lge.com> <575ab75d-1382-5f12-96df-53c0bb947f8c@suse.cz> In-Reply-To: <575ab75d-1382-5f12-96df-53c0bb947f8c@suse.cz> From: Joonsoo Kim Date: Thu, 9 Jul 2020 12:25:30 +0900 Message-ID: Subject: Re: [PATCH v4 11/11] mm/memory_hotplug: remove a wrapper for alloc_migration_target() To: Vlastimil Babka Cc: Andrew Morton , Linux Memory Management List , LKML , kernel-team@lge.com, Christoph Hellwig , Roman Gushchin , Mike Kravetz , Naoya Horiguchi , Michal Hocko , Joonsoo Kim Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Queue-Id: 8FF61100EDBFA X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: 2020=EB=85=84 7=EC=9B=94 8=EC=9D=BC (=EC=88=98) =EC=98=A4=EC=A0=84 1:34, Vl= astimil Babka =EB=8B=98=EC=9D=B4 =EC=9E=91=EC=84=B1: > > On 7/7/20 9:44 AM, js1304@gmail.com wrote: > > From: Joonsoo Kim > > > > To calculate the correct node to migrate the page for hotplug, we need > > to check node id of the page. Wrapper for alloc_migration_target() exis= ts > > for this purpose. > > > > However, Vlastimil informs that all migration source pages come from > > a single node. In this case, we don't need to check the node id for eac= h > > page and we don't need to re-set the target nodemask for each page by > > using the wrapper. Set up the migration_target_control once and use it = for > > all pages. > > > > Signed-off-by: Joonsoo Kim > > Acked-by: Vlastimil Babka > > Thanks! Nitpick below. > > > @@ -1345,9 +1324,28 @@ do_migrate_range(unsigned long start_pfn, unsign= ed long end_pfn) > > put_page(page); > > } > > if (!list_empty(&source)) { > > - /* Allocate a new page from the nearest neighbor node */ > > - ret =3D migrate_pages(&source, new_node_page, NULL, 0, > > - MIGRATE_SYNC, MR_MEMORY_HOTPLUG); > > + nodemask_t nmask =3D node_states[N_MEMORY]; > > + struct migration_target_control mtc =3D { > > + .nmask =3D &nmask, > > + .gfp_mask =3D GFP_USER | __GFP_MOVABLE | __GFP_RE= TRY_MAYFAIL, > > + }; > > + > > + /* > > + * We have checked that migration range is on a single zo= ne so > > + * we can use the nid of the first page to all the others= . > > + */ > > + mtc.nid =3D page_to_nid(list_first_entry(&source, struct = page, lru)); > > + > > + /* > > + * try to allocate from a different node but reuse this n= ode > > + * if there are no other online nodes to be used (e.g. we= are > > + * offlining a part of the only existing node) > > + */ > > + node_clear(mtc.nid, *mtc.nmask); > > + if (nodes_empty(*mtc.nmask)) > > + node_set(mtc.nid, *mtc.nmask); > > You could have kept using 'nmask' instead of '*mtc.nmask'. Actually that = applies > to patch 6 too, for less churn. You are right. I will change it. Thanks.