Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7195694ybi; Wed, 5 Jun 2019 12:58:15 -0700 (PDT) X-Google-Smtp-Source: APXvYqz6jJh6Uu5kTcGPhJ7uwbDGBRrWXA6u7WftVsrZ7UkOoTZT6ZrzsOc1p4GWqLKNOylpliTy X-Received: by 2002:a62:a511:: with SMTP id v17mr47470338pfm.129.1559764695546; Wed, 05 Jun 2019 12:58:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559764695; cv=none; d=google.com; s=arc-20160816; b=DC77PIqZP1X2WyQwXStjXrZuXWrCjp03N0W80ozTY7WgXE7nRZsLSz1UanYOmVYgeg 2n7O0H4xvDrCp6byGa9C/fA8mEu7gdcmH0LwJ6Lno7pdvpEGO2aeecCnA0pCtv33xwfZ qZxAX+8wNEslYv786dsb31zpPsqB5NfPkCUlARlfGhIcjiuNeGBodIz3TY7cWmlYWbtt VDhPjVtoQ5b9f/smQqHv8AdFVdcvVB6D1rirgIhoOP707cA9YrEmPveKfNmz+qAAmEUK 3IbY8OhUxiiymbXL2zhHw6y9joR+1GULsRSaSNp5hXHlHHICS5QM9fEUOBaHdn36NOJK kNOA== 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=9q4+At4yxP0TO9XKtv623886ZmeIrCw2KxtQ8rIVE+c=; b=mO0thdCo2TzKELNnU/nkB6CCgkfBPhx7t3mTJ8KvhkozSiVPuyUr2CYbVrx2UZtaYj AVlw91fRbILa51yicL1fSAZwv21UtHPCCmNaPdRUOdC8iRuUBBOktClD8ag+5BilIm7Q pI5eF2wQkbEEFPX+wipAnGoVmscPtpomwaSgsUx6Wj1AgoFz6Od+MUviesVyk64bPgRd U0Q6+SIaaBJHVUvg9H7NdGX78Q3kM0J41a0lDbNA13j8/ER71LY34ytY/zxMrNe4alaN xMjAsVRgpxf2m7TFB7iV4i4JNMBgs/KNNHcNR5B2heIZzDdaY/1eKwdzOl35K+ygnLkp xcOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=ONPOG0cr; 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=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d10si30395781pla.406.2019.06.05.12.57.58; Wed, 05 Jun 2019 12:58:15 -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=@google.com header.s=20161025 header.b=ONPOG0cr; 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=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726556AbfFET4s (ORCPT + 99 others); Wed, 5 Jun 2019 15:56:48 -0400 Received: from mail-yw1-f66.google.com ([209.85.161.66]:36768 "EHLO mail-yw1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726305AbfFET4s (ORCPT ); Wed, 5 Jun 2019 15:56:48 -0400 Received: by mail-yw1-f66.google.com with SMTP id t126so814963ywf.3 for ; Wed, 05 Jun 2019 12:56:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=9q4+At4yxP0TO9XKtv623886ZmeIrCw2KxtQ8rIVE+c=; b=ONPOG0criwRaERkMrKHfVu+FHkSVoaWJAe/3Qcz/W7LCrH5/GIScT4HA/6GrL0+9r8 o6co8aqwlNSEl7NCQ5sS9tePoeHt4h9GPb68IhajREN/xrsWKcvK3qyMit8mTn0Syc/A 7iA0JHtcd+FIK9ODp7RhnjbF13bEpwhQGYCei3mrBE/QI6K5gsvChkA/hORMbZ9/NFwj fOz5k6FisPTLo3cnO2KlMHYBKGSLayATbBhmtiVl0hlN7FVFEeyjwZxp9QJDFViYJ9Fr /8tGYfzZZKKv+lqP9TGaDdXxFpWTov0D05vVZG6KZ2JgmhFAjsoiImnW6hbJ2aiQ0DFz doOw== 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=9q4+At4yxP0TO9XKtv623886ZmeIrCw2KxtQ8rIVE+c=; b=gG6+UG7MhEuhOdyvlZsWr9KeajwfJNx31hztEbaBvJ7hsP92CePFjbY5eGKeHwhDaI Op46ttdhHSoiNPtLypdFYLQ+LEQ4o7oje088hIadxjVQscz3224iVGy5x/tm9+5ocyfc 9jfZqRfc26lo3sVgM60wZV2ZUxcOmdoqhFfDaIawfvuCaFM7q3ftvz0VRlY7USX5bt7V Kc8dJZ++OkoiTeMZNUy5Kkjduv2DG7qihhuupc+Q50BmJKLCFFdiG19ukGuCKWfTmBiC 11LCHOGA5zunj4PxvM3o8HaKMfHE4rVkm1wl0N0l4RWXvQMPguwOq2FnQithVX/e9PPB MfWg== X-Gm-Message-State: APjAAAUL6ZOCNMhkUqcmfUpfDjDo/374pvLn2XsyiG+xap4his978FOa 1fSPG1fIXUqTSvhGdsmlibb58tIW55+YgtXmdwVX0g== X-Received: by 2002:a81:a6d5:: with SMTP id d204mr22361086ywh.205.1559764607325; Wed, 05 Jun 2019 12:56:47 -0700 (PDT) MIME-Version: 1.0 References: <20190605100630.13293-1-teawaterz@linux.alibaba.com> In-Reply-To: <20190605100630.13293-1-teawaterz@linux.alibaba.com> From: Shakeel Butt Date: Wed, 5 Jun 2019 12:56:36 -0700 Message-ID: Subject: Re: [PATCH V3 1/2] zpool: Add malloc_support_movable to zpool_driver To: Hui Zhu Cc: Dan Streetman , Minchan Kim , ngupta@vflare.org, sergey.senozhatsky.work@gmail.com, Seth Jennings , Linux MM , LKML 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 Wed, Jun 5, 2019 at 3:06 AM Hui Zhu wrote: > > As a zpool_driver, zsmalloc can allocate movable memory because it > support migate pages. > But zbud and z3fold cannot allocate movable memory. > > This commit adds malloc_support_movable to zpool_driver. > If a zpool_driver support allocate movable memory, set it to true. > And add zpool_malloc_support_movable check malloc_support_movable > to make sure if a zpool support allocate movable memory. > > Signed-off-by: Hui Zhu Reviewed-by: Shakeel Butt IMHO no need to block this series on z3fold query. > --- > include/linux/zpool.h | 3 +++ > mm/zpool.c | 16 ++++++++++++++++ > mm/zsmalloc.c | 19 ++++++++++--------- > 3 files changed, 29 insertions(+), 9 deletions(-) > > diff --git a/include/linux/zpool.h b/include/linux/zpool.h > index 7238865e75b0..51bf43076165 100644 > --- a/include/linux/zpool.h > +++ b/include/linux/zpool.h > @@ -46,6 +46,8 @@ const char *zpool_get_type(struct zpool *pool); > > void zpool_destroy_pool(struct zpool *pool); > > +bool zpool_malloc_support_movable(struct zpool *pool); > + > int zpool_malloc(struct zpool *pool, size_t size, gfp_t gfp, > unsigned long *handle); > > @@ -90,6 +92,7 @@ struct zpool_driver { > struct zpool *zpool); > void (*destroy)(void *pool); > > + bool malloc_support_movable; > int (*malloc)(void *pool, size_t size, gfp_t gfp, > unsigned long *handle); > void (*free)(void *pool, unsigned long handle); > diff --git a/mm/zpool.c b/mm/zpool.c > index a2dd9107857d..863669212070 100644 > --- a/mm/zpool.c > +++ b/mm/zpool.c > @@ -238,6 +238,22 @@ const char *zpool_get_type(struct zpool *zpool) > return zpool->driver->type; > } > > +/** > + * zpool_malloc_support_movable() - Check if the zpool support > + * allocate movable memory > + * @zpool: The zpool to check > + * > + * This returns if the zpool support allocate movable memory. > + * > + * Implementations must guarantee this to be thread-safe. > + * > + * Returns: true if if the zpool support allocate movable memory, false if not > + */ > +bool zpool_malloc_support_movable(struct zpool *zpool) > +{ > + return zpool->driver->malloc_support_movable; > +} > + > /** > * zpool_malloc() - Allocate memory > * @zpool: The zpool to allocate from. > diff --git a/mm/zsmalloc.c b/mm/zsmalloc.c > index 0787d33b80d8..8f3d9a4d46f4 100644 > --- a/mm/zsmalloc.c > +++ b/mm/zsmalloc.c > @@ -437,15 +437,16 @@ static u64 zs_zpool_total_size(void *pool) > } > > static struct zpool_driver zs_zpool_driver = { > - .type = "zsmalloc", > - .owner = THIS_MODULE, > - .create = zs_zpool_create, > - .destroy = zs_zpool_destroy, > - .malloc = zs_zpool_malloc, > - .free = zs_zpool_free, > - .map = zs_zpool_map, > - .unmap = zs_zpool_unmap, > - .total_size = zs_zpool_total_size, > + .type = "zsmalloc", > + .owner = THIS_MODULE, > + .create = zs_zpool_create, > + .destroy = zs_zpool_destroy, > + .malloc_support_movable = true, > + .malloc = zs_zpool_malloc, > + .free = zs_zpool_free, > + .map = zs_zpool_map, > + .unmap = zs_zpool_unmap, > + .total_size = zs_zpool_total_size, > }; > > MODULE_ALIAS("zpool-zsmalloc"); > -- > 2.21.0 (Apple Git-120) >