Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp3475425ybl; Mon, 19 Aug 2019 19:54:56 -0700 (PDT) X-Google-Smtp-Source: APXvYqyP8/HYfoyeSPkuyvb5r23pk65NX5XvYNPNcZ4w6Ihq5mg30lpaNfehxJUEIazo3JDgpnbS X-Received: by 2002:a17:902:2bcb:: with SMTP id l69mr23676815plb.282.1566269696630; Mon, 19 Aug 2019 19:54:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566269696; cv=none; d=google.com; s=arc-20160816; b=IMLFDOB/4bmHDpo9cF1nEuNt2JwNNWrg2/ozDoh+fUU04MaSXL0LhgZd6Hlhciv7RR mm60+KFGJuM4eOWm5qeJ5EQQFnxf1CZtDKloBd+aqNmLxlt5jkjcjJpnb0KCZEooNSSW DspozY8Coh6VMiR2K1k20TKiZG1sOZx43HyO8uiQ4y9lkAstE6nCpwisptxkU2Z0HVet WgXfxe15AuhSYkeXiydW9ybMw23zO78j2aNMXcEg5FiOIKsMzQ+I2124/9RKtLTOnDGO x+z+sPE5z7raBb6j2VXJo4qZdY8xY9bpG2rKVbbY2+xpkK0OCFvr0lA0SsZhMbzmplEY Mb+Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=bqlUN1RbXA27ROpphRzaYTA2mgCbmo3KU3uDDJtbs+c=; b=VHAToN+C1oJsOdrbb1DJE2B2+SyrnS1ZC8uOwCsr8Wd5q31XUTyR0F0vi0s7q97UMn 3W18ctUpG1kpx1kgXUNBnv1LXD1gNY21K6g+XhUntsjlUGUOAjeS+cPHsIdPddvmRw9q RaK4zxZdoRY1mn+pmTAuerBVXlt0SLE43YIOpPwqpijduelbibyovbhJltUB5jMylYci BTunmrF5H3YInT2wA+QD1Em2+lZZyujA2puuo9UwP//8DAxoiUkWKFI5lSzXueQtl5u8 /rf21OEjIJ+SC0sKkK4M//3aNSIHDwYWFGY10Uu5Fl4vQRH1kyvsuENrttyjzymO5Hgf nEQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lr29nm3u; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u185si10939508pgd.561.2019.08.19.19.54.40; Mon, 19 Aug 2019 19:54:56 -0700 (PDT) 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=@gmail.com header.s=20161025 header.b=lr29nm3u; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729095AbfHTCxM (ORCPT + 99 others); Mon, 19 Aug 2019 22:53:12 -0400 Received: from mail-pf1-f194.google.com ([209.85.210.194]:43395 "EHLO mail-pf1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728647AbfHTCxL (ORCPT ); Mon, 19 Aug 2019 22:53:11 -0400 Received: by mail-pf1-f194.google.com with SMTP id v12so2395636pfn.10 for ; Mon, 19 Aug 2019 19:53:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=bqlUN1RbXA27ROpphRzaYTA2mgCbmo3KU3uDDJtbs+c=; b=lr29nm3uGUjC4tDgF6auRf/OYsKefNJqZ7MSVyRTDeoGlrPjplxyn9dfl4B7QryWg7 x2iMe30DUCe/+bRalNLIvdcqkkqA2y40Q4+Laqlxhe+Kpp/RuD7zB47Uik52cxzBuSrE +tGNU/BuG4845FxkLzP/MWpzfsG2SJShUa32NcjCz3HeBMpt16Uk6CMxj+wgsK81GPbD PCanrgFnXL+W5O10eya769ZA/qhWDd6mvxm/HX1PwGbOGYxPdUs86okmrqEud1qD9gne R5809FKmHRSZMLZ0ByVG2nNAQ6QpgIUO6NsyV4zu08Sz751NPR31SPBKgAOtpwpdgKdm G/qA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=bqlUN1RbXA27ROpphRzaYTA2mgCbmo3KU3uDDJtbs+c=; b=lfAwWOHXT57MNoG2IJ/yaJLcH1eA847hg1v1jLB7YhLyilcdE6+OQWKJu5cH/G5YKr 72ykbJ6aZXW6xv3vz8N+bQ8f3oK8Gh0YZJ7aNnuRMnVdOed1VTpyJZQfFh4kceeGGjf/ 3fnZwBhTVZq2G/IOZfNI32y4OOtPOUFwagJFqCsNlgEa5Ep0q+DCEdKsUL+1H0ownrnK JUftRi/hmOTEcqeFd5mbkzgf6ZnoXov+9ayT+Q3o0PWljkRcZUFJ0cNy3tXCILbTTvir bPcj7RoTp59dKmbFFgScU3msTHJpJ+/om+67l+wmtY2xgkxX36pBIf5ld3GYXNg/zw9d QWCg== X-Gm-Message-State: APjAAAViHARGzqUSLhvW0fws6leOeNFn6j4T4Ram9GRHtfYOE6FRT0KE nWDmZefx9rn/cz8c6nwgDnQ= X-Received: by 2002:aa7:8e10:: with SMTP id c16mr26972942pfr.124.1566269591111; Mon, 19 Aug 2019 19:53:11 -0700 (PDT) Received: from localhost ([175.223.16.125]) by smtp.gmail.com with ESMTPSA id k5sm20942706pfg.167.2019.08.19.19.53.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Aug 2019 19:53:10 -0700 (PDT) Date: Tue, 20 Aug 2019 11:53:07 +0900 From: Sergey Senozhatsky To: Henry Burns , Andrew Morton Cc: Minchan Kim , Nitin Gupta , Sergey Senozhatsky , Shakeel Butt , Jonathan Adams , HenryBurns , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2 v2] mm/zsmalloc.c: Migration can leave pages in ZS_EMPTY indefinitely Message-ID: <20190820025307.GC500@jagdpanzerIV> References: <20190809181751.219326-1-henryburns@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190809181751.219326-1-henryburns@google.com> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (08/09/19 11:17), Henry Burns wrote: > In zs_page_migrate() we call putback_zspage() after we have finished > migrating all pages in this zspage. However, the return value is ignored. > If a zs_free() races in between zs_page_isolate() and zs_page_migrate(), > freeing the last object in the zspage, putback_zspage() will leave the page > in ZS_EMPTY for potentially an unbounded amount of time. > > To fix this, we need to do the same thing as zs_page_putback() does: > schedule free_work to occur. To avoid duplicated code, move the > sequence to a new putback_zspage_deferred() function which both > zs_page_migrate() and zs_page_putback() call. > > Fixes: 48b4800a1c6a ("zsmalloc: page migration support") > Signed-off-by: Henry Burns Reviewed-by: Sergey Senozhatsky + Andrew -ss