From owner-freebsd-hackers@freebsd.org Mon Oct 12 23:39:05 2015 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BA1D3A12A4C for ; Mon, 12 Oct 2015 23:39:05 +0000 (UTC) (envelope-from gsuryacse7k@gmail.com) Received: from mail-vk0-x22f.google.com (mail-vk0-x22f.google.com [IPv6:2607:f8b0:400c:c05::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75C981D1A; Mon, 12 Oct 2015 23:39:05 +0000 (UTC) (envelope-from gsuryacse7k@gmail.com) Received: by vkat63 with SMTP id t63so723626vka.1; Mon, 12 Oct 2015 16:39:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SKPuu/ZVlRLr1PFJX7dhLmoxNwQF2yOr63cnHkGZhkg=; b=x5HH/mnyVPHdXjINtX5QymRLlPeghOTNxHERR34NAlWZa3qY81aT+blJtX4fwnMiDf vBtCf0Vv1g0JJnuShzkD1opkaVci6gMTTn2W/9zElNucctTP4vikq6Fvfkxt/Kp8/Yul vdqq7rYsQ85uiDj6rwRMbNRq1QSvvNKHLwhO2ZcJaz7ElrQiGgAodVwYWAu9p7DiNdsT djdJuVB3HvGWPbbkynvw5I9REvj3wXBcEahCXrf9tr8NpoGBcH/npEQOOV5WWJUYU7Rz yfA9xwchBs52noZVMB0SuwFpsg2GO+Z6rA4s3S3racZgIyFn3F2FQ+2ZFh403U/jaicl QcsA== MIME-Version: 1.0 X-Received: by 10.31.49.67 with SMTP id x64mr19937005vkx.133.1444693144154; Mon, 12 Oct 2015 16:39:04 -0700 (PDT) Received: by 10.103.26.3 with HTTP; Mon, 12 Oct 2015 16:39:04 -0700 (PDT) In-Reply-To: References: Date: Mon, 12 Oct 2015 19:39:04 -0400 Message-ID: Subject: Re: kernel pages superpage promotion/demotion From: suresh gumpula To: alc@freebsd.org Cc: "freebsd-hackers@freebsd.org" X-Mailman-Approved-At: Mon, 12 Oct 2015 23:55:17 +0000 Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 12 Oct 2015 23:39:05 -0000 Thanks a lot for quick reply Alan. The super page promotion/demotion of kernel allocations is done in 9.1 also I assume . Please confirm. Regarding write protection, I am trying to chase a corruption of uma zone allocation, so I was looking at pmap_protect(9). And thinking of using something like pmap_protect(kernel_pmap, sva , eva, VMPROT_READ); to write protect sva to eva of a zone allocation return address. So can pmap_protect(9) be used for this purpose ? Thanks Suresh On Mon, Oct 12, 2015 at 6:43 PM, Alan Cox wrote: > > > On Mon, Oct 12, 2015 at 3:11 PM, suresh gumpula > wrote: > >> Hi, >> I understand that user space VM map pages dynamically >> promoted/demoted to super page >> if the kernel thinks that it gains the performance. >> The question is , does this apply to kernel map pages too ? >> >> > > Yes, it applies to memory allocated for UMA zones, malloc(9), and > contigmalloc(9). > > > >> And is it possible to write protect kernel address space VA with >> pmap_protect(9). Since the protection is per 4k page, I see this >> routine tries to demote to 4k page. >> Or this is only for user space maps to support mprotect(2) and gdb >> watchpoints. >> Do we have any other API to write protect kernel addresses which come from >> UMA zone allocations ? >> >> > > No. > > Can you please try to describe what are you trying to do at a higher > level? >