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=-6.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 DD6BCC2D0E2 for ; Tue, 22 Sep 2020 10:08:57 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 583D5238D6 for ; Tue, 22 Sep 2020 10:08:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aYXfH4G/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 583D5238D6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id A68D1900051; Tue, 22 Sep 2020 06:08:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A181F900036; Tue, 22 Sep 2020 06:08:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8DE14900051; Tue, 22 Sep 2020 06:08:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0184.hostedemail.com [216.40.44.184]) by kanga.kvack.org (Postfix) with ESMTP id 75DF1900036 for ; Tue, 22 Sep 2020 06:08:56 -0400 (EDT) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 426B7180AD801 for ; Tue, 22 Sep 2020 10:08:56 +0000 (UTC) X-FDA: 77290273872.27.spade48_4601e302714c Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin27.hostedemail.com (Postfix) with ESMTP id 1740E3D663 for ; Tue, 22 Sep 2020 10:08:56 +0000 (UTC) X-HE-Tag: spade48_4601e302714c X-Filterd-Recvd-Size: 3469 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by imf15.hostedemail.com (Postfix) with ESMTP for ; Tue, 22 Sep 2020 10:08:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600769335; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=gGR7V9tUvMvnwzfQmUgvL1nLdW3VG7denZbrBkVV9h0=; b=aYXfH4G/tc8LC0y5nMtAspIFbgi3SfvXZgzr/d5b3mEb9ovU8xUgBrFblLVHBQAyaNpEnd x9aQBxTH17lrHz1o4cDRrRwE3S1JozpUPd0ZogAwd4KlVWHWva84OFVnsO/F4wlPRhL7lC ZdHaovoWBu32uEBBrpw2fyJx6pE6gbA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-111-urx0l_LYOWqn5Q15pZEV4w-1; Tue, 22 Sep 2020 06:08:51 -0400 X-MC-Unique: urx0l_LYOWqn5Q15pZEV4w-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A503B801AED; Tue, 22 Sep 2020 10:08:48 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.40.192.146]) by smtp.corp.redhat.com (Postfix) with SMTP id A1E1A5DA7B; Tue, 22 Sep 2020 10:08:41 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Tue, 22 Sep 2020 12:08:48 +0200 (CEST) Date: Tue, 22 Sep 2020 12:08:40 +0200 From: Oleg Nesterov To: Peter Xu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Jason Gunthorpe , Andrew Morton , Jan Kara , Michal Hocko , Kirill Tkhai , Kirill Shutemov , Hugh Dickins , Christoph Hellwig , Andrea Arcangeli , John Hubbard , Leon Romanovsky , Linus Torvalds , Jann Horn Subject: Re: [PATCH 3/5] mm: Rework return value for copy_one_pte() Message-ID: <20200922100840.GA11679@redhat.com> References: <20200921211744.24758-1-peterx@redhat.com> <20200921211744.24758-4-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200921211744.24758-4-peterx@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 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 09/21, Peter Xu wrote: > > @@ -866,13 +877,18 @@ static int copy_pte_range(struct mm_struct *dst_mm, struct mm_struct *src_mm, > pte_unmap_unlock(orig_dst_pte, dst_ptl); > cond_resched(); > > - if (entry.val) { > - if (add_swap_count_continuation(entry, GFP_KERNEL) < 0) > + switch (copy_ret) { > + case COPY_MM_SWAP_CONT: > + if (add_swap_count_continuation(data.entry, GFP_KERNEL) < 0) > return -ENOMEM; > - progress = 0; > + break; Note that you didn't clear copy_ret, it is still COPY_MM_SWAP_CONT, > + default: > + break; > } > + > if (addr != end) > goto again; After that the main loop can stop again because of need_resched(), and in this case add_swap_count_continuation(data.entry) will be called again? Oleg.