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=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham 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 8C092C433DB for ; Wed, 20 Jan 2021 14:18:37 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id F0C1E23355 for ; Wed, 20 Jan 2021 14:18:36 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F0C1E23355 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=soleen.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 38B646B000D; Wed, 20 Jan 2021 09:18:36 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 315F46B000E; Wed, 20 Jan 2021 09:18:36 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2031D6B0010; Wed, 20 Jan 2021 09:18:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0198.hostedemail.com [216.40.44.198]) by kanga.kvack.org (Postfix) with ESMTP id 06E806B000D for ; Wed, 20 Jan 2021 09:18:36 -0500 (EST) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id B72E48249980 for ; Wed, 20 Jan 2021 14:18:35 +0000 (UTC) X-FDA: 77726358990.25.move93_0f082632755b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id 8D3C81804E3A8 for ; Wed, 20 Jan 2021 14:18:35 +0000 (UTC) X-HE-Tag: move93_0f082632755b X-Filterd-Recvd-Size: 4821 Received: from mail-ej1-f47.google.com (mail-ej1-f47.google.com [209.85.218.47]) by imf04.hostedemail.com (Postfix) with ESMTP for ; Wed, 20 Jan 2021 14:18:34 +0000 (UTC) Received: by mail-ej1-f47.google.com with SMTP id hs11so31411280ejc.1 for ; Wed, 20 Jan 2021 06:18:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=soleen.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=aZwlx8a2SEsD8Y2Brb387uwcRDdsHOUIO/KUuY9o6cI=; b=j9kZRkJt6XM/YJtw6elaTf7SDrT4bVch1ktg1bCbaQETKnigjTRqkxDSUO2X50DqU8 ZoTtIuAsOg6j03jyo52Xos9i9XzC3Zi8qsrRe5G9x/mLzkpVC71uZvNFvYX27dYEXEXt PyeJ7Jvs9Pvp05A8DazANGflniIvTrQqg9LOODF2lIEP5WaOw6MJBQ1KOlPMdOItIK+C h07/NqETO30rEZKt9BYyCOgKWReY/ggoKT9OnNoGrGh6ADk74b7O9PXR6pkOuxsrEcwx nE09bh6yRT6LsIByxuM7ieVlWbTg67ovO8IDJHHcEJNx9XPyAueWj6jJGf5R5Lp+iaLZ dndw== 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; bh=aZwlx8a2SEsD8Y2Brb387uwcRDdsHOUIO/KUuY9o6cI=; b=Xs2HnzNK1Ezuj9s1dakvBgY1XGS/sbsPmDXCxf9a6QNbfs0YtJlDR7pcWiCc5xzlUd qvv4FYUOqJteAfoMCyjWfn2HpzmE9rWQ/jw2QwIt4frWTQJDKE3LcVZxtz9DP8aZrDro 0eFiggDlRJ3tObtZ3c+c3XFH+XKCO0gzQME9q1XyW2GyM1LoPB+FusUuetCiZrgHi0fB 5/PuRWT+S+ut6KOT+hhxtHobZa+cOyuKCJJubgYrL0godvenVeKq6nMi4iRMWA+anUsO l4T7hoV9PL5Vi3u+eBIhDfbxrfPa3f9FEN/32jQ4NHwuRcHxZrMHD7QwdZYUDsuX2T6Q EdRw== X-Gm-Message-State: AOAM533KBWtRnd9jqQrFV52FzR8i1UF2/+apHzewwppjLNdTnPZOwYVK hMR67uZezM5uT7I0SSKK7lqVCIxpiLc3Kyo5GqYK4g== X-Google-Smtp-Source: ABdhPJyLaWYZ6FSbAJyquHkBR6XAVgE8S/PCjTzGk5y8JvrkcOU4V+zWzNQnaWNiH3frmKDvChsPxoWvTHd/LnRpupI= X-Received: by 2002:a17:907:20aa:: with SMTP id pw10mr6125853ejb.314.1611152313325; Wed, 20 Jan 2021 06:18:33 -0800 (PST) MIME-Version: 1.0 References: <20210120014333.222547-1-pasha.tatashin@soleen.com> <20210120014333.222547-13-pasha.tatashin@soleen.com> <20210120131937.GG4605@ziepe.ca> In-Reply-To: <20210120131937.GG4605@ziepe.ca> From: Pavel Tatashin Date: Wed, 20 Jan 2021 09:17:57 -0500 Message-ID: Subject: Re: [PATCH v6 12/14] mm/gup: longterm pin migration cleaup To: Jason Gunthorpe Cc: LKML , linux-mm , Andrew Morton , Vlastimil Babka , Michal Hocko , David Hildenbrand , Oscar Salvador , Dan Williams , Sasha Levin , Tyler Hicks , Joonsoo Kim , mike.kravetz@oracle.com, Steven Rostedt , Ingo Molnar , Peter Zijlstra , Mel Gorman , Matthew Wilcox , David Rientjes , John Hubbard , Linux Doc Mailing List , Ira Weiny , linux-kselftest@vger.kernel.org Content-Type: text/plain; charset="UTF-8" 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 Wed, Jan 20, 2021 at 8:19 AM Jason Gunthorpe wrote: > > On Tue, Jan 19, 2021 at 08:43:31PM -0500, Pavel Tatashin wrote: > > When pages are longterm pinned, we must migrated them out of movable zone. > > The function that migrates them has a hidden loop with goto. The loop is > > to retry on isolation failures, and after successful migration. > > > > Make this code better by moving this loop to the caller. > > > > Signed-off-by: Pavel Tatashin > > mm/gup.c | 88 +++++++++++++++++++++++--------------------------------- > > 1 file changed, 36 insertions(+), 52 deletions(-) > > This looks OK, it is better > > Reviewed-by: Jason Gunthorpe > > I really dislike we always have to go over the page list twice in pin > mode I agree, I also dislike that we have to loop twice. > > The is_pinnable_page() and LRU isolation should really be done inside > __get_user_pages_locked() as each page is added to the output list > > But that is more of a larger issue than this series We could also think about adding some optimization flags, i.e. clients could tell gup that the pinned memory content can be discarded FOLL_DISCARD. That way we could always allocate new pages in the right zones as we do with this series and free existing translations. No migration check would be necessary with such a flag. > > Jason