Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp552031pxv; Thu, 22 Jul 2021 06:48:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuy1TEf01SRRG8Xgb/FlXeHyIflEeZbOof0QMuElWpfjlDZg34hmaZv9i2CNaC0I1cHtao X-Received: by 2002:a17:906:9c84:: with SMTP id fj4mr7975ejc.356.1626961691525; Thu, 22 Jul 2021 06:48:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626961691; cv=none; d=google.com; s=arc-20160816; b=Buh86Qyk1YzYBBY+cBqxY9hCJNIiZeUVrOwd1rhoRrF/i1IsuZwTIqG17pv4wGBumZ fj1jUnjoAjKuQ7Jhcz8bbRozI/EZ7Vz9n8ywbeeGZnQayZJKZ5A8usEL2TwWbc75K4jx caYLGo3PEdjc2mgm1/bi5wFbKpEwytzPpkjkr2xlnRyqhnLSCJCxgcWZLP+paCOwQhRJ R++KVJkY+wHBhhSDrf6OB83Mktr5WCq38ZA34m/HbJWEwqpEKpXLzpEZhg9iGzahTALN RQ2ZtjI2Z1cAmxKMafNhPcm+0goPntKPeUDTerNwMlhvTzPhB8PHDCGCcWj/qbgN/4uL E0Iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=S5FBe7ueCEgBBBcVlYIV5ZQBPwUEDI96bGTpteUkpVg=; b=hWvGyDeKc21GF2AXJ4EjuYq45AwNpLhwCG6RXC273ZSMZC9Ov/IjNXHlVa1Upe8Guj XSaHG5rw2Jiij2SdUhPtfhnkZtE28gU+AV4Zft9ComSonH2Hq0/foo2sZVJZPSBrIJsV bKQ10L3DRC+r+CMBLD0iDI82wXSKQKZ7uk8+ZLQ2WzNJKo4W4BIrgSzzEpuMUJwN0t6L CU2J0AsoK9RmvIgIUzttXgygXlSQrHDkTM0Z5H6DOxA+muoXZ3cWBfBb5unm3M2Z6C2w fgngKSgjyTeRiPbCjrrTOBL1uo2WIONYlURcrQAMk/P4/YeoTnjg4yHt/A0i/pgprvl5 1vHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ODQJCwhH; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d26si9799099edp.396.2021.07.22.06.47.46; Thu, 22 Jul 2021 06:48:11 -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=@gmail.com header.s=20161025 header.b=ODQJCwhH; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232138AbhGVNF2 (ORCPT + 99 others); Thu, 22 Jul 2021 09:05:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35550 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231925AbhGVNF1 (ORCPT ); Thu, 22 Jul 2021 09:05:27 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 71314C061575; Thu, 22 Jul 2021 06:46:02 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id u13so8570455lfs.11; Thu, 22 Jul 2021 06:46:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=S5FBe7ueCEgBBBcVlYIV5ZQBPwUEDI96bGTpteUkpVg=; b=ODQJCwhH4fpxxhVlyvc7qpPwR4JZiWsrgG8NvFvy5X3NG25wTU6ksHsU1cL8b1QGuU tp875eIubB65RbEhE7PNrtCX89VD3dgDJHWmRbjJ9fWOo3S8i12JKyydfYJK5k8O4IOE KTHILQtAAJA7SsGOAWfryjyQXAaZZg4ZS8+7xtQnzgv4DZGAUwMf2/poxEvFSI8dteOf 5V4oFyStMw5PiChxrAqttDR6C45175WAIq1FLMI6wrOKrPLTvI3CtdF7ipHlFsV8/MWo u3I7bty7jolpesArC0A8mwuHZEK3ccnYiL+3b7KRvvG4ZsPH2OnVhIcDTlGXByw1z8Qv mkZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=S5FBe7ueCEgBBBcVlYIV5ZQBPwUEDI96bGTpteUkpVg=; b=qKsoV6DOtwq/IYHkfEmOL4V+oAkfvmyeGpG9qGGasShQzmKMT32D07B+AqhlZaiyhZ wOrsxgaPVkepUi7KGsNrEcm2RHufFt0eM1cRlKqE8wKel8TlsmpEjSVu7OZPkmrNjx3D pykGXLHUxkvsLeXxK1NmOOWneD1aKqxHOlPIhLUKOGUfwDEwk0BC1BA8zDZMxAOHirQd kMdZHpfG2PQfmawrkIctM8dLOsErxoZsvRQ1iONMIZ99L6+vbU39ZIi7dGLRx4mYyy/A KqeJOAeeZO2V2XqHGASfqZRrZ7FdhbNbsv8z0byZt5x8T5I8aIogKGYcKWxZfE74W32L EHMA== X-Gm-Message-State: AOAM532SRjaHJft8Tq+k7DfwjKLNBvwTyy/AGvbMdloHH+aNpVxZfJep +3GVvXwh7p68UA8FWnPP0QY= X-Received: by 2002:a05:6512:3326:: with SMTP id l6mr28891434lfe.658.1626961560871; Thu, 22 Jul 2021 06:46:00 -0700 (PDT) Received: from [192.168.2.145] (79-139-184-182.dynamic.spd-mgts.ru. [79.139.184.182]) by smtp.googlemail.com with ESMTPSA id d23sm3102281ljl.115.2021.07.22.06.46.00 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 22 Jul 2021 06:46:00 -0700 (PDT) Subject: Re: [PATCH v14 062/138] mm/migrate: Add folio_migrate_copy() To: Matthew Wilcox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, "Theodore Y. Ts'o" References: <20210715033704.692967-1-willy@infradead.org> <20210715033704.692967-63-willy@infradead.org> From: Dmitry Osipenko Message-ID: Date: Thu, 22 Jul 2021 16:45:59 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 22.07.2021 15:29, Matthew Wilcox пишет: > On Thu, Jul 22, 2021 at 02:52:28PM +0300, Dmitry Osipenko wrote: ... > The obvious solution is just to change folio_copy(): > > { > - unsigned i, nr = folio_nr_pages(src); > + unsigned i = 0; > + unsigned nr = folio_nr_pages(src); > > - for (i = 0; i < nr; i++) { > - cond_resched(); > + for (;;) { > copy_highpage(folio_page(dst, i), folio_page(src, i)); > + if (i++ == nr) This works with the ++i precedence change. Thanks! > + break; > + cond_resched(); > } > } > > now it only calls cond_resched() for multi-page folios. ... Thank you for the explanation and for the fix! The fs/ and mm/ are mostly outside of my scope, hope you'll figure out the buffer-head case soon.