Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp559519imu; Wed, 2 Jan 2019 11:54:33 -0800 (PST) X-Google-Smtp-Source: AFSGD/USulvJ7hDDrCpZyzWxL20cM9Y8oPE/tfiky/pJn5atxUfYLT91PUQWTUTgkdEaSdtWIj8R X-Received: by 2002:a62:fc52:: with SMTP id e79mr46165921pfh.8.1546458873801; Wed, 02 Jan 2019 11:54:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546458873; cv=none; d=google.com; s=arc-20160816; b=VZslmV/qKi0DJPLdE9fdHeLHDNBv/577muXukf8L8HDsXOr7D1GM4yDS+IxDWd2PqY 4KIQ6XECiOQZhE+JRdI9IC9ypTQ0yOoKuLrotUwDyq8C4PKANgS8rqcvWMHiE472Qawf bV5LRfwKH6ejxsiT2XhxXEIsQ6DIJ3us0VqCoYu6YsdbU4cas2VyZNp7qfPSluIdX/IZ Ss8Ca85SA8ENJ/9N0yAUP+7cdbIDbIqCdzt6T2W3aUnyUUQmb2AHu6gkmrY8vHDAAVce kafEgPAk3QEEQXqLxNDrAIoZrAxXxvHK3eDI1KbIXQtBEi/IATJipS/9rOktE7H3noHk 9GVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=0hBUk8Mse5SprcZveZ649K7+7VQzzipNWH9bsLfG1zs=; b=GhHA9bZAZnb1p1mIlaE/q7k2hv/wrDj7mVzgHUX2KCmdSN/dIC/4wUUDygI6sVU8Im z4GlQL01qmvBB0rhKu2V30/W7d0jvgmzW4de2fHCZT27yfjQoMm8bw5gZz7i5B3YCMRJ /ihYFYWb9/eHeoZTnxfWDsfi5JU/WmZAqjRnosw2SApuFjG6wmIQZHF3CiLTpKJyKpZq 1LSJxUOV9zM3dGx82YgoyEzvTUiq212kuI8St+Qj1P3VH55GQWojcCDEsyLfIFfvsn1Q 69lEzH0qT4v9nTTO80ohYx3llauVt11FMQJeDUhpba13mfvOI0P9WE4yt2r30hWldwBb X2vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digitalocean.com header.s=google header.b=TDyu69lZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=digitalocean.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e68si34208886pfb.101.2019.01.02.11.53.59; Wed, 02 Jan 2019 11:54:33 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@digitalocean.com header.s=google header.b=TDyu69lZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=digitalocean.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726877AbfABRrx (ORCPT + 99 others); Wed, 2 Jan 2019 12:47:53 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:38467 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726044AbfABRrx (ORCPT ); Wed, 2 Jan 2019 12:47:53 -0500 Received: by mail-ot1-f66.google.com with SMTP id e12so27329057otl.5 for ; Wed, 02 Jan 2019 09:47:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digitalocean.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0hBUk8Mse5SprcZveZ649K7+7VQzzipNWH9bsLfG1zs=; b=TDyu69lZSUHU/VU7Ss2yo6UJzSknmMCUOHHR1EQDCiw2yNvY97ekNE8jOmsUl0EmTY 61ge1HunQ8fGibGB88QKzLie1fF/v7IE7xxdbwWDImQUcORxvHSY/k4s7ZmPIVy37XLr xJKiRqVlBW+w2PFwTuoGxZyRC2kaI4Z6SwgLk= 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=0hBUk8Mse5SprcZveZ649K7+7VQzzipNWH9bsLfG1zs=; b=DF89nEJeafzRKBDBhKmbtsRL93CUYfSAaZQG731TaEV9f/zTh7FtrhBUr21WmcZvDr 7NF+sogMNKB5MlSL4ZbWpJIdM+AI5eXFZXXRG6gRm0SaUtCUmrqMDskfE7kqbDXvbJj9 Eo7PkE3oHUOPmrVTRcar+J/tEg/PXplkoJJv7QyUYBcQHa6lyi86y5L3brzY5BYGk+Nf AF1K3JB3d8pyezUnHCYVZKKD8WWEQnt3FfD7bS/pSCDd/bfHTV0NoJRiN8+14D4g1Ch+ icZViESKnG4afwRgB3LPIrU4xkFbBHsKnQnOka8w/qaxZC7Rz1C9EFEvnwuFfdjmF3Y9 8JXw== X-Gm-Message-State: AJcUukdZhVGpJgkxWiZmBUgayMBvF7iyrs4SeLGtTf3kI1WK2t3Eo1YU jpyGcLrEaKbvXzUaMaubzj4aAb3LLZ24nuXuPqLCPw== X-Received: by 2002:a9d:1f3:: with SMTP id e106mr29318143ote.369.1546451272726; Wed, 02 Jan 2019 09:47:52 -0800 (PST) MIME-Version: 1.0 References: <20181203170934.16512-1-vpillai@digitalocean.com> <20181203170934.16512-2-vpillai@digitalocean.com> In-Reply-To: From: Vineeth Pillai Date: Wed, 2 Jan 2019 12:47:43 -0500 Message-ID: Subject: Re: [PATCH v3 2/2] mm: rid swapoff of quadratic complexity To: Hugh Dickins Cc: Matthew Wilcox , Andrew Morton , Huang Ying , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Kelley Nielsen , Rik van Riel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 1, 2019 at 11:16 PM Hugh Dickins wrote: > One more fix on top of what I sent yesterday: once I delved into > the retries, I found that the major cause of exceeding MAX_RETRIES > was the way the retry code neatly avoided retrying the last part of > its work. With this fix in, I have not yet seen retries go above 1: > no doubt it could, but at present I have no actual evidence that > the MAX_RETRIES-or-livelock issue needs to be dealt with urgently. > Fix sent for completeness, but it reinforces the point that the > structure of try_to_unuse() should be reworked, and oldi gone. > Thanks for the fix and suggestions Hugh! After reading the code again, I feel like we can make the retry logic simpler and avoid the use of oldi. If my understanding is correct, except for frontswap case, we reach try_to_unuse() only after we disable the swap device. So I think, we would not be seeing any more swap usage on the disabled swap device, after we loop through all the process and swapin the pages on that device. In that case, we would not need the retry logic right? For frontswap case, the patch was missing a check for pages_to_unuse. We would still need the retry logic, but as you mentioned, I can easily remove the oldi logic and make it simpler. Or probably, refactor the frontswap code out as a special case if pages_to_unuse is still not zero after the initial loop. Thanks, Vineeth