Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 20 Nov 2017 18:17:27 +0100
From:      Tijl Coosemans <tijl@FreeBSD.org>
To:        Kenneth Hatteland <kennethhatteland@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: FreeBSD 11.1 SSD low browser performance
Message-ID:  <20171120181727.7881bfd0@kalimero.tijl.coosemans.org>
In-Reply-To: <34c0a9bc-26f1-2203-eb9e-fc9ea00484de@gmail.com>
References:  <34c0a9bc-26f1-2203-eb9e-fc9ea00484de@gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
--MP_/.qy4G/biVXZ3Cn_fEk4794O
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

On Mon, 20 Nov 2017 16:22:26 +0100 Kenneth Hatteland <kennethhatteland@gmai=
l.com> wrote:
> I have a problem that annoys me and makes my desktop use painful. I have=
=20
> put a rather cheap Kingdian SSD into my box after my HDD seemed slow,=20
> but it did not enhance performance that much. It is when I use internet=20
> browsers the problem occurs. The browser works slow, freeze very often=20
> and video is choppy. It is from time to time impossible to switch=20
> between tabs, and graphics load painfully slow. When these things occur,=
=20
> the hard drive light blinks madly.
>=20
> When I use the machine with other software it is snappy and responsive.=20
> Music is flawless etc. So onlly when=C2=A0 I use firefox, Chromium or Iri=
dium.
>=20
> I have been thinking perhaps something about TRIM should be set up ? Or=20
> does anyone have other clues what I can do/check ?

If you have enough memory try mounting tmpfs on /tmp.  If not, try the
attached patch for firefox.  Just drop it in /usr/ports/www/firefox/files
and rebuild firefox.

--MP_/.qy4G/biVXZ3Cn_fEk4794O
Content-Type: text/x-patch
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename=patch-shmem

--- ipc/chromium/src/base/shared_memory.h.orig	2017-06-15 20:51:57 UTC
+++ ipc/chromium/src/base/shared_memory.h
@@ -114,7 +114,6 @@ class SharedMemory {
   // are technically only unique to a single filesystem. However, we always
   // allocate shared memory backing files from the same directory, so will end
   // up on the same filesystem.
-  SharedMemoryId id() const { return inode_; }
 #endif
 
   // Closes the open shared memory segment.
@@ -174,7 +173,6 @@ class SharedMemory {
   HANDLE             mapped_file_;
 #elif defined(OS_POSIX)
   int                mapped_file_;
-  ino_t              inode_;
 #endif
   void*              memory_;
   bool               read_only_;
--- ipc/chromium/src/base/shared_memory_posix.cc.orig	2017-06-15 20:51:57 UTC
+++ ipc/chromium/src/base/shared_memory_posix.cc
@@ -22,7 +22,6 @@ namespace base {
 
 SharedMemory::SharedMemory()
     : mapped_file_(-1),
-      inode_(0),
       memory_(NULL),
       read_only_(false),
       max_size_(0) {
@@ -41,7 +40,6 @@ bool SharedMemory::SetHandle(SharedMemoryHandle handle
   }
 
   mapped_file_ = handle.fd;
-  inode_ = st.st_ino;
   read_only_ = read_only;
   return true;
 }
@@ -155,13 +153,8 @@ bool SharedMemory::CreateOrOpen(const std::wstring &na
     // It doesn't make sense to have a read-only private piece of shmem
     DCHECK(posix_flags & (O_RDWR | O_WRONLY));
 
-    FilePath path;
-    fp = file_util::CreateAndOpenTemporaryShmemFile(&path);
-
-    // Deleting the file prevents anyone else from mapping it in
-    // (making it private), and prevents the need for cleanup (once
-    // the last fd is closed, it is truly freed).
-    file_util::Delete(path);
+    int fd = shm_open(SHM_ANON, posix_flags, 0600);
+    fp = fdopen(fd, "a+");
   } else {
     std::wstring mem_filename;
     if (FilenameForMemoryName(name, &mem_filename) == false)
@@ -214,7 +207,6 @@ bool SharedMemory::CreateOrOpen(const std::wstring &na
   struct stat st;
   if (fstat(mapped_file_, &st))
     NOTREACHED();
-  inode_ = st.st_ino;
 
   return true;
 }
@@ -224,7 +216,7 @@ bool SharedMemory::Map(size_t bytes) {
     return false;
 
   memory_ = mmap(NULL, bytes, PROT_READ | (read_only_ ? 0 : PROT_WRITE),
-                 MAP_SHARED, mapped_file_, 0);
+                 MAP_SHARED | MAP_NOSYNC, mapped_file_, 0);
 
   if (memory_)
     max_size_ = bytes;

--MP_/.qy4G/biVXZ3Cn_fEk4794O--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20171120181727.7881bfd0>