From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.0 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84306C33CB2 for ; Fri, 31 Jan 2020 06:40:41 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 3ACC82082E for ; Fri, 31 Jan 2020 06:40:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="key not found in DNS" (0-bit key) header.d=mg.codeaurora.org header.i=@mg.codeaurora.org header.b="l5Ey62vc" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3ACC82082E Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id B27196B05AB; Fri, 31 Jan 2020 01:40:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id AD8466B05AD; Fri, 31 Jan 2020 01:40:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9C7216B05AE; Fri, 31 Jan 2020 01:40:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0043.hostedemail.com [216.40.44.43]) by kanga.kvack.org (Postfix) with ESMTP id 821C26B05AB for ; Fri, 31 Jan 2020 01:40:40 -0500 (EST) Received: from smtpin20.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 3E95E180AD802 for ; Fri, 31 Jan 2020 06:40:40 +0000 (UTC) X-FDA: 76436981040.20.sail86_79d03bdef3839 X-HE-Tag: sail86_79d03bdef3839 X-Filterd-Recvd-Size: 4503 Received: from mail25.static.mailgun.info (mail25.static.mailgun.info [104.130.122.25]) by imf13.hostedemail.com (Postfix) with ESMTP for ; Fri, 31 Jan 2020 06:40:36 +0000 (UTC) DKIM-Signature: a=rsa-sha256; v=1; c=relaxed/relaxed; d=mg.codeaurora.org; q=dns/txt; s=smtp; t=1580452839; h=Content-Transfer-Encoding: Content-Type: In-Reply-To: MIME-Version: Date: Message-ID: From: References: Cc: To: Subject: Sender; bh=C4QB4M4fKOaUUkrXU+/PFkSTNwpbFRIW0mgYlUgOiLc=; b=l5Ey62vc8DtD4lAaBDwd7bNv6+EAhzgoDekbKxxl3FZRAKI4plO2Dj6Ect1GjWn9em7RzQa2 hO3+BjLGuZVTnMhsy2on+Mr2Vct03iGKphuX1TnlsIOyX4yMNdAK+f/vI4MB2ByZsbAVdg2P ONlG0816n21TO5O1yNCyOVA/CMU= X-Mailgun-Sending-Ip: 104.130.122.25 X-Mailgun-Sid: WyIwY2Q3OCIsICJsaW51eC1tbUBrdmFjay5vcmciLCAiYmU5ZTRhIl0= Received: from smtp.codeaurora.org (ec2-35-166-182-171.us-west-2.compute.amazonaws.com [35.166.182.171]) by mxa.mailgun.org with ESMTP id 5e33cbdc.7fb222cd6500-smtp-out-n01; Fri, 31 Jan 2020 06:40:28 -0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1001) id ED642C433CB; Fri, 31 Jan 2020 06:40:27 +0000 (UTC) Received: from [10.204.79.71] (blr-c-bdr-fw-01_GlobalNAT_AllZones-Outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: vjitta) by smtp.codeaurora.org (Postfix) with ESMTPSA id 3F38AC43383; Fri, 31 Jan 2020 06:40:22 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 3F38AC43383 Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: aws-us-west-2-caf-mail-1.web.codeaurora.org; spf=none smtp.mailfrom=vjitta@codeaurora.org Subject: Re: [PATCH] mm: slub: reinitialize random sequence cache on slab object update To: Christopher Lameter Cc: penberg@kernel.org, rientjes@google.com, iamjoonsoo.kim@lge.com, akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.or, vinmenon@codeaurora.org, kernel-team@android.com References: <1580379523-32272-1-git-send-email-vjitta@codeaurora.org> From: Vijayanand Jitta Message-ID: <1383cd32-1ddc-4dac-b5f8-9c42282fa81c@codeaurora.org> Date: Fri, 31 Jan 2020 12:09:43 +0530 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On 1/30/2020 11:58 PM, Christopher Lameter wrote: > On Thu, 30 Jan 2020, vjitta@codeaurora.org wrote: > >> Random sequence cache is precomputed during slab object creation >> based up on the object size and no of objects per slab. These could >> be changed when flags like SLAB_STORE_USER, SLAB_POISON are updated >> from sysfs. So when shuffle_freelist is called during slab_alloc it > > Sorry no. That cannot happen. Changing the size of the slab is only > possible if no slab pages are allocated. Any sysfs changes that affect the > object size must fail if object and slab pages are already allocated. > > If you were able to change the object size then we need to prevent that > from happening. > Yes, size of slab can't be changed after objects are allocated, that holds true even with this change. Let me explain a bit more about the use case here ZRAM compression uses the slub allocator, by enabling the slub debug flags like SLAB_STORE_USER etc.. the memory consumption will rather be increased which doesn't serve the purpose of ZRAM compression. So, such flags are to be disabled before the allocations happen, this requires updation of random sequence cache as object size and number of objects change after these flags are disabled. So, the sequence will be 1. Slab creation (this will set a precomputed random sequence cache) 2. Remove the debug flags 3. update the random sequence cache 4. Mount zram and then start using it for allocations. Thanks, Vijay