Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3807504pxk; Tue, 22 Sep 2020 03:10:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxTCrFniKv2mSMRB1tI8bPDydnM3gihZfRpymfWVJ47rQvnFcQf4YfgahfDuVcDFKFZP+mA X-Received: by 2002:a17:906:ecf1:: with SMTP id qt17mr4131160ejb.158.1600769431382; Tue, 22 Sep 2020 03:10:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600769431; cv=none; d=google.com; s=arc-20160816; b=ZXrioRme2/jB/Mev7wCMXc+zcvqmDv3Qux4XtXqdpSYm0la4Tsjq/7h3FT50CCjMZD g3x/IQWkUPFN1P9fDniaItlGsO90VQJwOvnTu2Sl9agGLKj5RFn47A9yj8PqMiHjc09L 1bWKU8657nPO08a5Y5C9EJOynN9T+rIQouS0hTCRa7dQY07YMgbDM5VczH0Ih8t1c9eZ 3Kit6/ECnKidGLuYrvbRQH4FpNEweXejCH6dEDeT+t7Z+F7UuPF163SDUpmjj+0TUtzS iQLFMvK2+siNQBcQRilkn2dRffoQqu/GpwAY+ZrZv24BW5SzAucqmRT6g6TKyp3bnOPm yQcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=gGR7V9tUvMvnwzfQmUgvL1nLdW3VG7denZbrBkVV9h0=; b=A473SIfqfQTmW4j6oC6euv2WVpdjV/7ErSLkNjYC4zKF7mfZnZ0i+iSxFnW8pirc1m 79Xaq3PWde6+5zaibUUARQrHR9Y6VSwzdWwtVDiUlQ4Quup+pqxC9GBHTo2E6WwMHl0/ ULLnU/LKwNndQOXLhk1l+LL8yC5QGo3la1b9zRIWTHDmjUwj+LULJe7/Ui0uhJDkg0qe CDyiQCUPv1A5LTLnfoIZOD3LtBWA0NaMR3JXnKxlZ/q0cyOl+bwjpN3g0e1ffIAWsPXe iPKsITXufZQfSubvRZdNV7Agv0W2IbV6FDhHW9whN13Rxfz32rg1qcTAhmPxGovFudoF kQgQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V53pX2Nc; 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v5si10437724edx.502.2020.09.22.03.10.07; Tue, 22 Sep 2020 03:10:31 -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; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V53pX2Nc; 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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726553AbgIVKI4 (ORCPT + 99 others); Tue, 22 Sep 2020 06:08:56 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:28838 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726514AbgIVKI4 (ORCPT ); Tue, 22 Sep 2020 06:08:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1600769334; 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=V53pX2Nc9BnjtDw6F+QY0oIg4gS5TLX5qkksRIMW2/eOQ+AShET6FUh2Y8pvbVAMPh3M+p QwzwKxqkBjCnJOpPqD5XD+CQ79io9pnmQTKRLrpIPT2/hobl5lx94bjRXdFK0tiPeZoUHT V54JMFOrzEZbpIw7F3vLVzMFdXAAY9w= 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.